From 49e1bfb72ba1924ebdf9550b80fdcc202656869b Mon Sep 17 00:00:00 2001
From: David Doty
Date: Tue, 8 Oct 2024 06:30:53 -0500
Subject: [PATCH] added build files
---
examples/0-three-from-end.nfa | 11 +
examples/0s1s2s.nfa | 12 +
examples/balanced-parens.cfg | 8 +
examples/contains-010.regex | 3 +
examples/count-a-wildcard.tm | 21 ++
examples/double-inferred-states.tm | 16 +
examples/double.tm | 16 +
examples/no-000-end.dfa | 27 ++
examples/palindrome-single-tape.tm | 30 ++
examples/w-marker-w-wildcard.tm | 30 ++
examples/w-marker-w.tm | 26 ++
help.html | 475 +++++++++++++++++++++++++++++
index.html | 81 +++++
simulator-embed.html | 108 +++++++
simulator.html | 10 +
src/Main.js | 1 +
src/default_model.js | 48 +++
src/file-upload.js | 38 +++
src/get-ace-themes.js | 67 ++++
src/mode-cfg.js | 62 ++++
src/mode-dfa.js | 108 +++++++
src/mode-nfa.js | 109 +++++++
src/mode-regex.js | 47 +++
src/mode-tm.js | 150 +++++++++
styles.css | 131 ++++++++
25 files changed, 1635 insertions(+)
create mode 100644 examples/0-three-from-end.nfa
create mode 100644 examples/0s1s2s.nfa
create mode 100644 examples/balanced-parens.cfg
create mode 100644 examples/contains-010.regex
create mode 100644 examples/count-a-wildcard.tm
create mode 100644 examples/double-inferred-states.tm
create mode 100644 examples/double.tm
create mode 100644 examples/no-000-end.dfa
create mode 100644 examples/palindrome-single-tape.tm
create mode 100644 examples/w-marker-w-wildcard.tm
create mode 100644 examples/w-marker-w.tm
create mode 100644 help.html
create mode 100644 index.html
create mode 100644 simulator-embed.html
create mode 100644 simulator.html
create mode 100644 src/Main.js
create mode 100644 src/default_model.js
create mode 100644 src/file-upload.js
create mode 100644 src/get-ace-themes.js
create mode 100644 src/mode-cfg.js
create mode 100644 src/mode-dfa.js
create mode 100644 src/mode-nfa.js
create mode 100644 src/mode-regex.js
create mode 100644 src/mode-tm.js
create mode 100644 styles.css
diff --git a/examples/0-three-from-end.nfa b/examples/0-three-from-end.nfa
new file mode 100644
index 0000000..e4d7b25
--- /dev/null
+++ b/examples/0-three-from-end.nfa
@@ -0,0 +1,11 @@
+states = {q1,q2,q3,q4}
+input_alphabet = {0,1}
+start_state = q1
+accept_states = {q4}
+delta =
+ q1,0 -> {q1,q2};
+ q1,1 -> q1;
+ q2,0 -> q3;
+ q2,1 -> q3;
+ q3,0 -> q4;
+ q3,1 -> q4;
\ No newline at end of file
diff --git a/examples/0s1s2s.nfa b/examples/0s1s2s.nfa
new file mode 100644
index 0000000..ae8a405
--- /dev/null
+++ b/examples/0s1s2s.nfa
@@ -0,0 +1,12 @@
+// This NFA recognizes the language described by the regular expression 0*1*2*
+
+states = {q0,q1,q2}
+input_alphabet = {0,1,2}
+start_state = q0
+accept_states = {q2}
+delta =
+ q0,0 -> q0;
+ q0, -> q1;
+ q1,1 -> q1;
+ q1, -> q2;
+ q2,2 -> q2;
diff --git a/examples/balanced-parens.cfg b/examples/balanced-parens.cfg
new file mode 100644
index 0000000..f164153
--- /dev/null
+++ b/examples/balanced-parens.cfg
@@ -0,0 +1,8 @@
+// This context-free grammar generates the language of balanced (square bracket) parentheses.
+
+S -> [S] | SS | ;
+
+// The line above is equivalent to writing
+// S -> [S];
+// S -> SS;
+// S -> ;
\ No newline at end of file
diff --git a/examples/contains-010.regex b/examples/contains-010.regex
new file mode 100644
index 0000000..7cf7e39
--- /dev/null
+++ b/examples/contains-010.regex
@@ -0,0 +1,3 @@
+// matches any binary string containing the substring 010
+B = (0|1)*; // subexpression matching any binary string
+B 010 B
\ No newline at end of file
diff --git a/examples/count-a-wildcard.tm b/examples/count-a-wildcard.tm
new file mode 100644
index 0000000..f60321c
--- /dev/null
+++ b/examples/count-a-wildcard.tm
@@ -0,0 +1,21 @@
+// This TM counts the number of a's on the first tape and writes that
+// number of 0's on the second tape. It demonstrates the use of the ?
+// wildcard in specifying transition rules. Note that because they have
+// no wildcard symbols, the rules
+// q1,a_ -> q1,a0,RR;
+// and
+// q1,__ -> qA,__,SS;
+// overrride the wildcard rule
+// q1,?_ -> q1,?_,RS;
+
+states = {q,qA,qR}
+input_alphabet = {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}
+tape_alphabet_extra = {0,_}
+start_state = q
+accept_state = qA
+reject_state = qR
+num_tapes = 2
+delta =
+ q,?_ -> q, ?_,RS;
+ q,a_ -> q, a0,RR;
+ q,__ -> qA,__,SS;
\ No newline at end of file
diff --git a/examples/double-inferred-states.tm b/examples/double-inferred-states.tm
new file mode 100644
index 0000000..db3d440
--- /dev/null
+++ b/examples/double-inferred-states.tm
@@ -0,0 +1,16 @@
+// This TM computes the function f(0^n) = 0^{2n}.
+
+states = ? // the state names are inferred from the rest of the definition
+input_alphabet = {0}
+tape_alphabet = {_,!}
+start_state = q0
+accept_state = qA
+reject_state = qR
+num_tapes = 2
+delta =
+ q0,0_ -> q1,0!,SR;
+ q1,0_ -> q2,00,SR;
+ q2,0_ -> q1,00,RR;
+ q1,__ -> qD,__,SL;
+ qD,_0 -> qD,_0,SL;
+ qD,_! -> qA,_!,SR;
\ No newline at end of file
diff --git a/examples/double.tm b/examples/double.tm
new file mode 100644
index 0000000..728f03b
--- /dev/null
+++ b/examples/double.tm
@@ -0,0 +1,16 @@
+// This TM computes the function f(0^n) = 0^{2n}.
+
+states = {q0,q1,q2,qD,qA,qR}
+input_alphabet = {0}
+tape_alphabet_extra = {!,_}
+start_state = q0
+accept_state = qA
+reject_state = qR
+num_tapes = 2
+delta =
+ q0,0_ -> q1,0!,SR;
+ q1,0_ -> q2,00,SR;
+ q2,0_ -> q1,00,RR;
+ q1,__ -> qD,__,SL;
+ qD,_0 -> qD,_0,SL;
+ qD,_! -> qA,_!,SR;
\ No newline at end of file
diff --git a/examples/no-000-end.dfa b/examples/no-000-end.dfa
new file mode 100644
index 0000000..692034a
--- /dev/null
+++ b/examples/no-000-end.dfa
@@ -0,0 +1,27 @@
+// This DFA recognizes { x in {0,1}* | x does not end in 000 }
+
+states = {q, // last bit was a 1 or non-existent
+ q0, // last two bits were 10
+ q00, // last three bits were 100
+ q000} // last three bits were 000
+
+input_alphabet = {0,1}
+
+start_state = q // no last bit when we start
+
+accept_states = {q,q0,q00} // accept if last three bits were not 000
+
+delta =
+ // if we see a 1, reset
+ q,1 -> q;
+ q0,1 -> q;
+ q00,1 -> q;
+ q000,1 -> q;
+
+ // if we see a 0, count one more 0 than before
+ q,0 -> q0;
+ q0,0 -> q00;
+ q00,0 -> q000;
+
+ // until we get to three
+ q000,0 -> q000;
diff --git a/examples/palindrome-single-tape.tm b/examples/palindrome-single-tape.tm
new file mode 100644
index 0000000..d520876
--- /dev/null
+++ b/examples/palindrome-single-tape.tm
@@ -0,0 +1,30 @@
+// This TM recognizes the language { w in {0,1}* | w = w^R }
+
+states = {s,r00,r11,r01,r10,l,lx,qA,qR}
+input_alphabet = {0,1}
+tape_alphabet_extra = {x,_}
+start_state = s
+accept_state = qA
+reject_state = qR
+delta =
+ s,0 -> r00,x,R;
+ s,1 -> r11,x,R;
+ r00,0 -> r00,0,R;
+ r00,1 -> r01,1,R;
+ r01,0 -> r00,0,R;
+ r01,1 -> r01,1,R;
+ r10,0 -> r10,0,R;
+ r10,1 -> r11,1,R;
+ r11,0 -> r10,0,R;
+ r11,1 -> r11,1,R;
+ r00,_ -> lx,_,L;
+ r11,_ -> lx,_,L;
+ r00,x -> lx,x,L;
+ r11,x -> lx,x,L;
+ lx, 0 -> l,x,L;
+ lx, 1 -> l,x,L;
+ lx, x -> qA,x,S;
+ l, 0 -> l,0,L;
+ l, 1 -> l,1,L;
+ l, x -> s,x,R;
+ s, x -> qA,x,S;
\ No newline at end of file
diff --git a/examples/w-marker-w-wildcard.tm b/examples/w-marker-w-wildcard.tm
new file mode 100644
index 0000000..d3fe56b
--- /dev/null
+++ b/examples/w-marker-w-wildcard.tm
@@ -0,0 +1,30 @@
+// This TM recognizes the language { w:w | w is a string in {0,1}* }
+// It is the same as the one described in w-marker-w.tm.
+
+// It demonstrates the use of the ? wildcard in specifying transition rules.
+
+states = {q1,q2,q3,q4,q5,q6,q7,q8,qA,qR}
+input_alphabet = {0,1,:}
+tape_alphabet_extra = {x,_}
+start_state = q1
+accept_state = qA
+reject_state = qR
+num_tapes = 1
+delta =
+ q1,0 -> q2,x,R;
+ q1,1 -> q3,x,R;
+ q1,: -> q8,:,R;
+ q2,? -> q2,?,R;
+ q2,: -> q4,:,R;
+ q3,? -> q3,?,R;
+ q3,: -> q5,:,R;
+ q4,0 -> q6,x,L;
+ q4,x -> q4,x,R;
+ q5,1 -> q6,x,L;
+ q5,x -> q5,x,R;
+ q6,? -> q6,?,L;
+ q6,: -> q7,:,L;
+ q7,? -> q7,?,L;
+ q7,x -> q1,x,R;
+ q8,x -> q8,x,R;
+ q8,_ -> qA,_,R;
diff --git a/examples/w-marker-w.tm b/examples/w-marker-w.tm
new file mode 100644
index 0000000..60255e2
--- /dev/null
+++ b/examples/w-marker-w.tm
@@ -0,0 +1,26 @@
+states = {q1,q2,q3,q4,q5,q6,q7,q8,qA,qR}
+input_alphabet = {0,1,:}
+tape_alphabet_extra ={x,_}
+start_state = q1
+accept_state = qA
+reject_state = qR
+num_tapes = 1
+delta =
+ q1,0 -> q2,x,R;
+ q1,1 -> q3,x,R;
+ q1,: -> q8,:,R;
+ q2,? -> q2,?,R;
+ q2,: -> q4,:,R;
+ q3,? -> q3,?,R;
+ q3,: -> q5,:,R;
+ q4,0 -> q6,x,L;
+ q4,x -> q4,x,R;
+ q5,1 -> q6,x,L;
+ q5,x -> q5,x,R;
+ q6,? -> q6,?,L;
+ q6,: -> q7,:,L;
+ q6,x -> q6,x,L;
+ q7,? -> q7,?,L;
+ q7,x -> q1,x,R;
+ q8,x -> q8,x,R;
+ q8,_ -> qA,_,R;
\ No newline at end of file
diff --git a/help.html b/help.html
new file mode 100644
index 0000000..719d616
--- /dev/null
+++ b/help.html
@@ -0,0 +1,475 @@
+
+
+
+
+
+
+
+ automata simulator usage
+
+
+
+
+
+Automaton simulator usage instructions
+
+
+This is a help file for the automaton simulator here .
+It can be used to create and test deterministic and nondeterministic finite automata, regular expressions, context-free grammars, and (deterministic) Turing machines.
+
+
+
+This application is mainly tested with the Chrome web browser,
+and it may have problems with other web browsers.
+
+
+
+Please send questions/bug reports to
+
+
+
+This application was written in Elm .
+
+
+
+How to use
+
+Play around!
+Most features are self-explanatory.
+Below are some notes about aspects that may require more detailed explanation.
+
+
+Entering input
+
+ If the option "Run immediately" is selected, then all changes to input and automaton descriptions are immediately processed.
+ If you uncheck this box, then a "Run" button will appear, which must be pressed to see if the automaton description is valid, and if so, what is the result of running the automaton on the input.
+ This may be useful if the simulator is taking a long time to process each change, for instance if the Turing machine has an infinite loop.
+
+
+ To load a text file from your computer into the editor window, click the "Choose file" button next to "Upload:".
+ To save the contents of the editor to a file on your computer, click the "Download" button.
+ Pressing the "Load Default" button will replace the editor with a description of the default automaton for that type.
+
+
+ The contents of the editor are automatically saved locally in your browser's local storage,
+ so when you first open the page,
+ the editor should display the same thing you saw last time the page was open.
+ However , this is merely for convenience and should not be relied upon:
+ it is strongly recommended to save the file manually when you are done working.
+ If the app is updated, for instance, a bug or a change in storage format may erase your stored data.
+
+
+Clearing local storage if app does not load
+
+ There may be rare circumstances where the app does not load due to a bug in how it loads the automaton from your browser's local storage.
+ To clear local storage (which should reset the app), follow these steps.
+
+ Open the simulator web page .
+ Open Developer Tools by pressing Ctrl+Shift+I in Chrome or Firefox.
+ (Alternately, in Chrome click on the top right menu → More tools → Developer tools,
+ and in Firefox click on the top right menu → Web Developer → Web Developer Tools.)
+ Once Developer Tools are open, select "Application" in Chrome or "Storage" in Firefox.
+ Click "Local Storage" on the left.
+ Right-click https://web.cs.ucdavis.edu/ and select "Clear".
+ Refresh the page.
+
+
+
+
+Example input files
+
+
+ The easiest way to explain the input file format is by example.
+ The files
+ no-000-end.dfa ,
+ contains-010.regex ,
+ 0-three-from-end.nfa ,
+ 0s1s2s.nfa ,
+ balanced-parens.cfg ,
+ double.tm ,
+
+ and
+
+ palindrome-single-tape.tm
+ are examples of input files for the finite automata, regular expression, context-free grammar, and Turing machine simulators.
+
+
+Turing machine simulation time limit
+
+ Turing machines are run for at most 10,000 steps.
+
+
+Turing machine left move on leftmost tape cell
+
+ If a Turing machine attempts to move a tape head left when it is already
+ on the leftmost tape cell, then the tape head stays where it is instead.
+
+
+Step-by-step simulation
+
+ The finite automata and Turing machine simulators have a back and forward
+ button to step through individual transitions of the machine.
+ In both cases the current state is highlighted.
+ In the case of Turing machines, the tape(s) are shown with the tape head
+ position(s) highlighted.
+
+
+
+ In the case of finite automata, the input is shown with a caret symbol
+ ^ placed in between the symbol just read and the
+ symbol about to be read.
+ For example, in reading the string 0010 , the
+ finite automaton will have four transitions and visit five states total,
+ with the "read position" being indicated in each case as:
+
+ ^0 0 1 0
+ 0^0 1 0
+ 0 0^1 0
+ 0 0 1^0
+ 0 0 1 0^
+
+
+
+
+ If the input field and editor are not selected,
+ then the , and .
+ (comma and period) keys can
+ also be used to do forward and backward transitions. This can be useful
+ to quickly jump several transitions ahead by holding down the key.
+
+
+Output conventions for Turing machines
+
+ Turing machines have two different notions of "output".
+
+
+
+ Boolean output, which is indicated by whether the final
+ configuration is in the accept state or the reject state.
+
+
+
+
+ string output, used to define Turing machines that compute
+ functions f: Σ* → Σ* .
+
+
+ The string output in the final configuration is represented on the last tape.
+ The output is defined to be the string
+ from the tape head to the first blank to the right (represented by an underscore
+ _ ), not including the blank.
+ This means that although the input is from the input alphabet, the
+ output could have nonblank symbols from the tape alphabet.
+
+
+ For instance, suppose the content of the last tape is
+ bb_bbabbaba_abb_bbb__
+ and the tape head at the leftmost
+ a .
+ Then the output string is
+ abbaba .
+
+ If the content of the last tape is
+ _abbaba_abb_bbb__
+ and the tape head is at position 0
+ (in other words, if the tape head is scanning a blank symbol),
+ then the output string is the empty string ε.
+
+
+
+
+
+Notes about file format
+
+
+
+ Whitespace is mostly ignored.
+ Since whitespace otherwise gets trimmed away, whitespace characters cannot be in any alphabet.
+
+
+
+
+ State names can be multi-character strings, with characters that are either alphanumeric,
+ an underscore _
,
+ a hyphen -
,
+ parentheses (
and )
,
+ or a prime (apostophe) '
.
+ Alphabet symbols should be single characters, which can be any symbol from the keyboard except for the following,
+ which have special syntactical meaning in the automata files:
+
+
+
+ curly braces {
and }
, used to enclose sets
+
+
+ comma ,
, used to separate lists of items (such as each state in the set of states)
+
+
+ pipe |
, used for nondeterministic productions in CFGs and union in Regex's (this only applies to CFG and Regex symbols; DFA, NFA, and TM can use |
as an alphabet symbol)
+
+
+ question mark ?
, used as a special character for Turing machine wildcard transition rules
+
+
+ whitespace characters (e.g., space, tab, newline)
+
+
+
+
+
+
+ In regular expressions, only the following characters are allowed:
+ the operators
+ ( ) * + | ,
+ alphanumeric characters,
+ and (because of a homework problem involving email addresses)
+ the characters
+ .
+ and
+ @ .
+ Note that | is used to mean ∪.
+ Unlike most regular expression libraries in programming languages, spaces are ignored (including newlines),
+ which can help you to visually separate different parts of the regular expression.
+
+
+ Warning:
+
+ Comments are poorly supported in regular expressions.
+ If you are having trouble, try removing all comments.
+
+
+
+
+
+ The various parts of the automaton (states
, input_alphabet
, etc.) must be specified in the same order given in the example files.
+
+
+
+
+ .nfa
files are almost the same syntax as .dfa
files, with two exceptions:
+
+
+ You can write
+ q, -> r;
+ to represent an ε-transition from state q
to r
.
+ See 0s1s2s.nfa for an example.
+
+
+
+ You can write
+ q,0 -> {r,s,t};
+ to represent a nondeterministic transition to any of states r,s,t
+ (from state q
while reading a 0
).
+ See 0-three-from-end.nfa for an example.
+ You can also write several lines to specify multiple output states, such as
+
+ q,0 -> r;
+
+ q,0 -> s;
+
+ q,0 -> t;
+
+
+
+
+
+
+
+
.regex
files can define variables with subexpressions. For example
+
+ A = 0|1;
+
+ B = A2;
+
+ 34B | 56A
+
+ is equivalent to the regex 34((0|1)2) | 56(0|1)
.
+ Each subexpression may reference previous variables.
+ The last expression appears after the last semicolon (with no variable definition or equals sign).
+ This can help with avoiding typing long subexpressions multiple times.
+ Also, you can use longer variable names for subexpressions, which is helpful when the input alphabet contains all single letters. It will not work properly to use single-letter variable names such as A or b in this case.
+ For example
+
+ Sigma = q|w|e|r|t|y|u|i|o|p|a|s|d|f|g|h|j|k|l|z|x|c|v|b|n|m|Q|W|E|R|T|Y|U|I|O|P|A|S|D|F|G|H|J|K|L|Z|X|C|V|B|N|M;
+
+ Sigma* abc Sigma* abc Sigma* abc Sigma*
+
+ matches any word with three appearances of abc
in it.
+
+
+
+ Warning:
+
+ Do not use newlines within a subexpression. Most of the automata simulator is robust to newlines, but using newlines within a subexpression will put the symbols \n into your final regex. Put each subexpression on a single line.
+
+
+ However, be careful with this feature!
+ It works by simply substituting each subexpression in all the remaining ones.
+ So it is possible (and inadvisable) to write a short regex that will blow up the memory requirements exponentially,
+ e.g.,
+
+
A = 0123456789;
+
+ B = AAAAAAAAAA;
+
+ C = BBBBBBBBBB;
+
+ D = CCCCCCCCCC;
+
+ E = DDDDDDDDDD;
+
+ F = EEEEEEEEEE;
+
+ G = FFFFFFFFFF;
+
+ G
+
+ which defines a regular expression with ten million symbols in it.
+
+
+
+
+
+ .cfg
files use character
+ |
to represent multiple production rules on the same line, e.g.
+ S -> A|B;
is equivalent to
+ S -> A;
and S -> B;
.
+ Note that an ε-production can be included by, e.g.,
+ S -> A|;
+ which is equivalent to
+ S -> A;
and S -> ;
+
+
+
+
+
+
+ A k-tape TM is specified with transition rules using strings of length k for
+ the input symbols, the output symbols, and moves.
+ For example, the transition rule q,001 -> r,111,RSL;
+ is for a 3-tape TM and specifies that
+ in state q
,
+ reading a 0
on the first tape,
+ a 0
on the second tape,
+ and a 1
on the third tape,
+ the TM should change to state r
,
+ write a 1
on the first tape
+ and move its tape head right,
+ a 1
on the second tape
+ and don't move its tape head,
+ and a 1
on the third tape
+ and move its tape head left.
+
+
+
+
+ DFA transition functions must be defined explicitly on all inputs.
+ In other words, if you have |Q|=k states
+ and |Σ|=m symbols, there must be exactly k·m transitions for
+ δ, one for each pair (q,b), where q ∈ Q and b ∈ Σ.
+
+
+
+
+ In contrast, NFA and TM transition functions do not need to be fully specified;
+ they take default values for any inputs not specified.
+ If Δ(q,b) is left unspecified for an NFA, then it is assumed Δ(q,b) = Ø.
+ If δ(q,b) is left unspecified for a TM, then it is assumed
+ δ(q,b) = (qr ,b,S), where qr is the reject state.
+
+
+
+
+
+
+ The files
+ count-a-wildcard.tm
+ and
+ w-marker-w-wildcard.tm
+ show how to use the wildcard symbol ?
+ to avoid typing many transitions that do the same thing.
+ The symbol matching the wildcard can either be written over
+ (if a non-wildcard symbol appears in the output, e.g., q,0? -> r,11,RS;
)
+ or copied
+ (if ?
appears in the output, e.g., q,0? -> r,1?,RS;
).
+ For each tape, if a wildcard appears as an output, then it must also appear as an input for the same tape,
+ and in this case it means "copy whatever symbol matched the wildcard in the input".
+ For example, the following is not allowed:
+ q,00 -> r,1?,RS;
.
+
+
+
+ If there is a wildcard-containing transition that matches
+ a wildcard-free transition, the latter takes precedence. For example,
+ count-a-wildcard.tm
+ uses the wildcard-free transitions
+ q1,a_ -> q1,a0,RR;
+ and
+ q1,__ -> qA,__,SS;
,
+ if they match, before using the wildcard transition
+ q1,?_ -> q1,?_,RS;
.
+
+
+
+ In fact, it is required to use this feature if there is a state q
such that
+ two wildcard transitions with input state q
+ overlap , in the sense that they both match the same tuple of input symbols.
+ For example,
+ q,0?1 -> r,111,RS;
+ and
+ q,??1 -> t,000,LL;
+ both match tuples
+ 001
+ and
+ 011
.
+ To disambiguate what to do if
+ 001
+ or
+ 011
+ is encountered when in state q
,
+ there must be wildcard-free transitions with input state q
+ for both
+ 001
+ and
+ 011
.
+ Thus the case above would be an error if there were not also transitions of the form
+ q,001 -> ...
+ and
+ q,011 -> ...
.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..7bbb2a0
--- /dev/null
+++ b/index.html
@@ -0,0 +1,81 @@
+
+
+
+
+ simulator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/simulator-embed.html b/simulator-embed.html
new file mode 100644
index 0000000..6fd11cd
--- /dev/null
+++ b/simulator-embed.html
@@ -0,0 +1,108 @@
+
+
+
+
+ simulator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/simulator.html b/simulator.html
new file mode 100644
index 0000000..4fb7ffb
--- /dev/null
+++ b/simulator.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+ This page has been moved. Click here.
+
+
diff --git a/src/Main.js b/src/Main.js
new file mode 100644
index 0000000..49b2b6e
--- /dev/null
+++ b/src/Main.js
@@ -0,0 +1 @@
+!function(){"use strict";function l(n){function t(r){return function(t){return n(r,t)}}return t.arity=2,t.func=n,t}function s(e){function t(n){return function(r){return function(t){return e(n,r,t)}}}return t.arity=3,t.func=e,t}function f(o){function t(e){return function(n){return function(r){return function(t){return o(e,n,r,t)}}}}return t.arity=4,t.func=o,t}function t(c){function t(o){return function(e){return function(n){return function(r){return function(t){return c(o,e,n,r,t)}}}}}return t.arity=5,t.func=c,t}function u(u){function t(c){return function(o){return function(e){return function(n){return function(r){return function(t){return u(c,o,e,n,r,t)}}}}}}return t.arity=6,t.func=u,t}function r(i){function t(u){return function(c){return function(o){return function(e){return function(n){return function(r){return function(t){return i(u,c,o,e,n,r,t)}}}}}}}return t.arity=7,t.func=i,t}function n(_){function t(i){return function(u){return function(c){return function(o){return function(e){return function(n){return function(r){return function(t){return _(i,u,c,o,e,n,r,t)}}}}}}}}return t.arity=8,t.func=_,t}function m(t,r,n){return 2===t.arity?t.func(r,n):t(r)(n)}function v(t,r,n,e){return 3===t.arity?t.func(r,n,e):t(r)(n)(e)}function d(t,r,n,e,o){return 4===t.arity?t.func(r,n,e,o):t(r)(n)(e)(o)}function b(t,r,n,e,o,c){return 5===t.arity?t.func(r,n,e,o,c):t(r)(n)(e)(o)(c)}function p(t,r,n,e,o,c,u){return 6===t.arity?t.func(r,n,e,o,c,u):t(r)(n)(e)(o)(c)(u)}function h(t,r,n,e,o,c,u,i){return 7===t.arity?t.func(r,n,e,o,c,u,i):t(r)(n)(e)(o)(c)(u)(i)}function a(t,r,n,e,o,c,u,i,_){return 8===t.arity?t.func(r,n,e,o,c,u,i,_):t(r)(n)(e)(o)(c)(u)(i)(_)}var e,o,c,i=(e=["LT","EQ","GT"],{div:l(function(t,r){return t/r|0}),rem:l(function(t,r){return t%r}),mod:l(function t(r,n){if(0===n)throw new Error("Cannot perform mod 0. Division by zero error.");var e=r%n,r=0===r?0:0";if("boolean"==r)return t?"True":"False";if("number"==r)return t+"";if(t instanceof String)return"'"+k(t,!0)+"'";if("string"==r)return'"'+k(t,!1)+'"';if(null===t)return"null";if("object"==r&&"ctor"in t){var n=t.ctor.substring(0,5);if("_Tupl"===n){var e=[];for(i in t)"ctor"!==i&&e.push(w(t[i]));return"("+e.join(",")+")"}if("_Task"===n)return"";if("_Array"===t.ctor)return"Array.fromList "+w(Ze(t));if(""===t.ctor)return"";if("_Process"===t.ctor)return"";if("::"===t.ctor){e="["+w(t._0);for(t=t._1;"::"===t.ctor;)e+=","+w(t._0),t=t._1;return e+"]"}if("[]"===t.ctor)return"[]";if("Set_elm_builtin"===t.ctor)return"Set.fromList "+w(zo(t));if("RBNode_elm_builtin"===t.ctor||"RBEmpty_elm_builtin"===t.ctor)return"Dict.fromList "+w(Sr(t));var o,c,u,e="";for(o in t)"ctor"!==o&&(e+=" "+("{"===(u=(c=w(t[o]))[0])||"("===u||"<"===u||'"'===u||c.indexOf(" ")<0?c:"("+c+")"));return t.ctor+e}if("object"!=r)return"";if(t instanceof Date)return"<"+t.toString()+">";if(t.elm_web_socket)return"";var i,e=[];for(i in t)e.push(i+" = "+w(t[i]));return 0===e.length?"{}":"{ "+e.join(", ")+" }"}function k(t,r){t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return r?t.replace(/\'/g,"\\'"):t.replace(/\"/g,'\\"')}var S=l(function(t,r){return m(t,r._0,r._1)}),x=(s(function(t,r,n){return t({ctor:"_Tuple2",_0:r,_1:n})}),s(function(t,r,n){return m(t,n,r)})),B=l(function(t,r){return t}),R=function(t){return t},N=N||{};N["<|"]=l(function(t,r){return t(r)}),(N=N||{})["|>"]=l(function(t,r){return r(t)}),(N=N||{})[">>"]=s(function(t,r,n){return r(t(n))}),(N=N||{})["<<"]=s(function(t,r,n){return t(r(n))}),(N=N||{})["++"]=g.append;var A=g.toString,q=(i.isInfinite,i.isNaN,i.toFloat),C=(i.ceiling,i.floor,i.truncate,i.round);i.not,i.xor;(N=N||{})["||"]=i.or,(N=N||{})["&&"]=i.and;var M=i.max,E=i.min,L=i.compare;(N=N||{})[">="]=i.ge,(N=N||{})["<="]=i.le,(N=N||{})[">"]=i.gt,(N=N||{})["<"]=i.lt,(N=N||{})["/="]=i.neq,(N=N||{})["=="]=i.eq;i.e,i.pi,i.clamp,i.logBase,i.abs,i.negate,i.sqrt,i.atan2,i.atan,i.asin,i.acos,i.tan,i.sin,i.cos;(N=N||{})["^"]=i.exp,(N=N||{})["%"]=i.mod;i.rem;(N=N||{})["//"]=i.div,(N=N||{})["/"]=i.floatDiv,(N=N||{})["*"]=i.mul,(N=N||{})["-"]=i.sub,(N=N||{})["+"]=i.add;i.toPolar,i.fromPolar,i.turns,i.degrees;var O,D=l(function(t,r){return"Just"===r.ctor?r._0:t}),P={ctor:"Nothing"},I=l(function(t,r){return"Just"===r.ctor?t(r._0):P}),F=function(t){return{ctor:"Just",_0:t}},J=l(function(t,r){return"Just"===r.ctor?F(t(r._0)):P}),z=s(function(t,r,n){n={ctor:"_Tuple2",_0:r,_1:n};return"_Tuple2"===n.ctor&&"Just"===n._0.ctor&&"Just"===n._1.ctor?F(m(t,n._0._0,n._1._0)):P}),U=(f(function(t,r,n,e){e={ctor:"_Tuple3",_0:r,_1:n,_2:e};return"_Tuple3"===e.ctor&&"Just"===e._0.ctor&&"Just"===e._1.ctor&&"Just"===e._2.ctor?F(v(t,e._0._0,e._1._0,e._2._0)):P}),t(function(t,r,n,e,o){o={ctor:"_Tuple4",_0:r,_1:n,_2:e,_3:o};return"_Tuple4"===o.ctor&&"Just"===o._0.ctor&&"Just"===o._1.ctor&&"Just"===o._2.ctor&&"Just"===o._3.ctor?F(d(t,o._0._0,o._1._0,o._2._0,o._3._0)):P}),u(function(t,r,n,e,o,c){c={ctor:"_Tuple5",_0:r,_1:n,_2:e,_3:o,_4:c};return"_Tuple5"===c.ctor&&"Just"===c._0.ctor&&"Just"===c._1.ctor&&"Just"===c._2.ctor&&"Just"===c._3.ctor&&"Just"===c._4.ctor?F(b(t,c._0._0,c._1._0,c._2._0,c._3._0,c._4._0)):P}),{Nil:O={ctor:"[]"},Cons:W,cons:l(W),toArray:G,fromArray:j,foldr:s(function(t,r,n){for(var e=G(n),o=r,c=e.length;c--;)o=m(t,e[c],o);return o}),map2:s(function(t,r,n){for(var e=[];"[]"!==r.ctor&&"[]"!==n.ctor;)e.push(m(t,r._0,n._0)),r=r._1,n=n._1;return j(e)}),map3:f(function(t,r,n,e){for(var o=[];"[]"!==r.ctor&&"[]"!==n.ctor&&"[]"!==e.ctor;)o.push(v(t,r._0,n._0,e._0)),r=r._1,n=n._1,e=e._1;return j(o)}),map4:t(function(t,r,n,e,o){for(var c=[];"[]"!==r.ctor&&"[]"!==n.ctor&&"[]"!==e.ctor&&"[]"!==o.ctor;)c.push(d(t,r._0,n._0,e._0,o._0)),r=r._1,n=n._1,e=e._1,o=o._1;return j(c)}),map5:u(function(t,r,n,e,o,c){for(var u=[];"[]"!==r.ctor&&"[]"!==n.ctor&&"[]"!==e.ctor&&"[]"!==o.ctor&&"[]"!==c.ctor;)u.push(b(t,r._0,n._0,e._0,o._0,c._0)),r=r._1,n=n._1,e=e._1,o=o._1,c=c._1;return j(u)}),sortBy:l(function(n,t){return j(G(t).sort(function(t,r){return g.cmp(n(t),n(r))}))}),sortWith:l(function(n,t){return j(G(t).sort(function(t,r){r=n(t)(r).ctor;return"EQ"===r?0:"LT"===r?-1:1}))})});function W(t,r){return{ctor:"::",_0:t,_1:r}}function j(t){for(var r=O,n=t.length;n--;)r=W(t[n],r);return r}function G(t){for(var r=[];"[]"!==t.ctor;)r.push(t._0),t=t._1;return r}var H=U.sortWith,V=U.sortBy,K=l(function(t,r){for(;;){if(g.cmp(t,0)<1)return r;var n=r;if("[]"===n.ctor)return r;t=t-1,r=n._1}}),Q=U.map5,$=U.map4,X=U.map3,Y=U.map2,Z=l(function(t,r){for(;;){var n=r;if("[]"===n.ctor)return!1;if(t(n._0))return!0;t=t,r=n._1}}),tt=l(function(r,t){return!m(Z,function(t){return!r(t)},t)}),rt=U.foldr,nt=s(function(t,r,n){for(;;){var e=n;if("[]"===e.ctor)return r;var o=t,c=m(t,e._0,r);t=o,r=c,n=e._1}}),et=function(t){return v(nt,l(function(t,r){return r+1}),0,t)},ot=function(t){return"::"===t.ctor?F(v(nt,M,t._0,t._1)):P},ct=l(function(r,t){return m(Z,function(t){return g.eq(t,r)},t)}),ut=function(t){return"[]"===t.ctor},it=function(t){return"::"===t.ctor?F(t._1):P},_t=function(t){return"::"===t.ctor?F(t._0):P},at=at||{};at["::"]=U.cons;var ft=l(function(n,t){return v(rt,l(function(t,r){return{ctor:"::",_0:n(t),_1:r}}),{ctor:"[]"},t)}),lt=l(function(n,t){var r=l(function(t,r){return n(t)?{ctor:"::",_0:t,_1:r}:r});return v(rt,r,{ctor:"[]"},t)}),st=s(function(t,r,n){r=t(r);return"Just"===r.ctor?{ctor:"::",_0:r._0,_1:n}:n}),dt=(l(function(t,r){return v(rt,st(t),{ctor:"[]"},r)}),function(t){return v(nt,l(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},t)}),pt=s(function(n,t,r){var e=l(function(t,r){return"::"===r.ctor?{ctor:"::",_0:m(n,t,r._0),_1:r}:{ctor:"[]"}});return dt(v(nt,e,{ctor:"::",_0:t,_1:{ctor:"[]"}},r))}),ht=l(function(t,r){return"[]"===r.ctor?t:v(rt,l(function(t,r){return{ctor:"::",_0:t,_1:r}}),r,t)}),gt=function(t){return v(rt,ht,{ctor:"[]"},t)},mt=l(function(t,r){return gt(m(ft,t,r))}),vt=l(function(e,t){var r=l(function(t,r){var n=r._0,r=r._1;return e(t)?{ctor:"_Tuple2",_0:{ctor:"::",_0:t,_1:n},_1:r}:{ctor:"_Tuple2",_0:n,_1:{ctor:"::",_0:t,_1:r}}});return v(rt,r,{ctor:"_Tuple2",_0:{ctor:"[]"},_1:{ctor:"[]"}},t)}),bt=function(t){var r=l(function(t,r){return{ctor:"_Tuple2",_0:{ctor:"::",_0:t._0,_1:r._0},_1:{ctor:"::",_0:t._1,_1:r._1}}});return v(rt,r,{ctor:"_Tuple2",_0:{ctor:"[]"},_1:{ctor:"[]"}},t)},Tt=(l(function(n,t){var r=t;if("[]"===r.ctor)return{ctor:"[]"};t=l(function(t,r){return{ctor:"::",_0:n,_1:{ctor:"::",_0:t,_1:r}}}),t=v(rt,t,{ctor:"[]"},r._1);return{ctor:"::",_0:r._0,_1:t}}),s(function(t,r,n){for(;;){if(g.cmp(t,0)<1)return n;var e=r;if("[]"===e.ctor)return n;t=t-1,r=e._1,n={ctor:"::",_0:e._0,_1:n}}})),yt=l(function(t,r){return dt(v(Tt,t,r,{ctor:"[]"}))}),wt=s(function(t,r,n){if(g.cmp(r,0)<1)return{ctor:"[]"};var e={ctor:"_Tuple2",_0:r,_1:n};t:do{r:do{if("_Tuple2"!==e.ctor)break t;if("[]"===e._1.ctor)return n;if("::"!==e._1._1.ctor){if(1===e._0)break r;break t}switch(e._0){case 1:break r;case 2:return{ctor:"::",_0:e._1._0,_1:{ctor:"::",_0:e._1._1._0,_1:{ctor:"[]"}}};case 3:if("::"===e._1._1._1.ctor)return{ctor:"::",_0:e._1._0,_1:{ctor:"::",_0:e._1._1._0,_1:{ctor:"::",_0:e._1._1._1._0,_1:{ctor:"[]"}}}};break t;default:if("::"!==e._1._1._1.ctor||"::"!==e._1._1._1._1.ctor)break t;var o=e._1._1._1._0,c=e._1._1._0,u=e._1._0,i=e._1._1._1._1._0,_=e._1._1._1._1._1;return 0=t.length&&r.lastIndexOf(t)===r.length-t.length}),indexes:l(function(t,r){var n=t.length;if(n<1)return U.Nil;for(var e=0,o=[];-1<(e=r.indexOf(t,e));)o.push(e),e+=n;return U.fromArray(o)}),toInt:function(t){var r=t.length;if(0===r)return Mt(t);if("0"===(e=t[0])&&"x"===t[1]){for(var n=2;n>=1,r+=r;return n}function Mt(t){return Vt("could not convert string '"+t+"' to an Int")}function Et(t){return Vt("could not convert string '"+t+"' to a Float")}function Lt(t){return Ht(t)||v(Wt,g.chr("a"),g.chr("f"),t)||v(Wt,g.chr("A"),g.chr("F"),t)}function Ot(t){var r=t;t:do{if("RBNode_elm_builtin"===r.ctor){if("BBlack"===r._0.ctor)return 1;break t}if("LBBlack"===r._0.ctor)return 1;break t}while(0)}function Dt(t){return"RBNode_elm_builtin"===t.ctor?b(Wr,Pr(t._0),t._1,t._2,t._3,t._4):Jr(Fr)}var Pt,It,Ft,Jt={fromCode:function(t){return g.chr(String.fromCharCode(t))},toCode:function(t){return t.charCodeAt(0)},toUpper:function(t){return g.chr(t.toUpperCase())},toLower:function(t){return g.chr(t.toLowerCase())},toLocaleUpper:function(t){return g.chr(t.toLocaleUpperCase())},toLocaleLower:function(t){return g.chr(t.toLocaleLowerCase())}},zt=Jt.fromCode,Ut=Jt.toCode,Wt=(Jt.toLocaleLower,Jt.toLocaleUpper,Jt.toLower,Jt.toUpper,s(function(t,r,n){n=Ut(n);return-1",_1:{ctor:"[]"}}}}}}}}}}))}),Nr=l(function(t,r){for(;;){var n=r;if("RBEmpty_elm_builtin"===n.ctor)return t;t=m(Nr,t+1,n._4),r=n._3}}),Ar=function(t){return m(Nr,0,t)},qr=l(function(t,r){t:for(;;){var n=r;if("RBEmpty_elm_builtin"===n.ctor)return P;switch(m(L,t,n._1).ctor){case"LT":t=t,r=n._3;continue t;case"EQ":return F(n._2);default:t=t,r=n._4;continue t}}}),Cr=l(function(t,r){return"Just"===m(qr,t,r).ctor}),Mr=s(function(t,r,n){for(;;){var e=n;if("RBEmpty_elm_builtin"===e.ctor)return{ctor:"_Tuple2",_0:t,_1:r};t=e._1,r=e._2,n=e._4}}),Er={ctor:"NBlack"},Lr={ctor:"BBlack"},Or={ctor:"Black"},Dr={ctor:"Red"},Pr=function(t){switch(t.ctor){case"BBlack":return Or;case"Black":return Dr;case"Red":return Er;default:return At.crash("Can't make a negative black node less black!")}},Ir={ctor:"LBBlack"},Fr={ctor:"LBlack"},Jr=function(t){return{ctor:"RBEmpty_elm_builtin",_0:t}},zr=Jr(Fr),Ur=function(t){return g.eq(t,zr)},Wr=t(function(t,r,n,e,o){return{ctor:"RBNode_elm_builtin",_0:t,_1:r,_2:n,_3:e,_4:o}}),jr=function(f){return function(a){return function(_){return function(i){return function(u){return function(c){return function(o){return function(e){return function(n){return function(r){return function(t){return b(Wr,Pr(f),i,u,b(Wr,Or,a,_,e,n),b(Wr,Or,c,o,r,t))}}}}}}}}}}},Gr=function(t){return"RBEmpty_elm_builtin"===t.ctor?At.crash("can't make a Leaf red"):b(Wr,Dr,t._1,t._2,t._3,t._4)},Hr=t(function(t,r,n,e,o){o=b(Wr,t,r,n,e,o);return function(t){if("RBNode_elm_builtin"!==t.ctor)return!0;t=t._0;return g.eq(t,Or)||g.eq(t,Lr)}(o)?function(t){var r=t;t:do{r:do{n:do{e:do{o:do{c:do{u:do{if("RBNode_elm_builtin"!==r.ctor)break t;if("RBNode_elm_builtin"===r._3.ctor)if("RBNode_elm_builtin"===r._4.ctor)switch(r._3._0.ctor){case"Red":switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break e;break t;case"NBlack":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break n;break t;default:if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;break t}case"NBlack":switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break e;if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t;case"NBlack":if("BBlack"!==r._0.ctor)break t;if("RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break n;if("RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t;default:if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t}default:switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break e;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break n;break t;default:break t}}else switch(r._3._0.ctor){case"Red":if("RBNode_elm_builtin"===r._3._3.ctor&&"Red"===r._3._3._0.ctor)break u;if("RBNode_elm_builtin"===r._3._4.ctor&&"Red"===r._3._4._0.ctor)break c;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._3._3.ctor&&"Black"===r._3._3._0.ctor&&"RBNode_elm_builtin"===r._3._4.ctor&&"Black"===r._3._4._0.ctor)break r;break t;default:break t}else{if("RBNode_elm_builtin"!==r._4.ctor)break t;switch(r._4._0.ctor){case"Red":if("RBNode_elm_builtin"===r._4._3.ctor&&"Red"===r._4._3._0.ctor)break o;if("RBNode_elm_builtin"===r._4._4.ctor&&"Red"===r._4._4._0.ctor)break e;break t;case"NBlack":if("BBlack"===r._0.ctor&&"RBNode_elm_builtin"===r._4._3.ctor&&"Black"===r._4._3._0.ctor&&"RBNode_elm_builtin"===r._4._4.ctor&&"Black"===r._4._4._0.ctor)break n;break t;default:break t}}}while(0);return jr(r._0)(r._3._3._1)(r._3._3._2)(r._3._1)(r._3._2)(r._1)(r._2)(r._3._3._3)(r._3._3._4)(r._3._4)(r._4)}while(0);return jr(r._0)(r._3._1)(r._3._2)(r._3._4._1)(r._3._4._2)(r._1)(r._2)(r._3._3)(r._3._4._3)(r._3._4._4)(r._4)}while(0);return jr(r._0)(r._1)(r._2)(r._4._3._1)(r._4._3._2)(r._4._1)(r._4._2)(r._3)(r._4._3._3)(r._4._3._4)(r._4._4)}while(0);return jr(r._0)(r._1)(r._2)(r._4._1)(r._4._2)(r._4._4._1)(r._4._4._2)(r._3)(r._4._3)(r._4._4._3)(r._4._4._4)}while(0);return b(Wr,Or,r._4._3._1,r._4._3._2,b(Wr,Or,r._1,r._2,r._3,r._4._3._3),b(Hr,Or,r._4._1,r._4._2,r._4._3._4,Gr(r._4._4)))}while(0);return b(Wr,Or,r._3._4._1,r._3._4._2,b(Hr,Or,r._3._1,r._3._2,Gr(r._3._3),r._3._4._3),b(Wr,Or,r._1,r._2,r._3._4._4,r._4))}while(0);return t}(o):o}),Vr=t(function(t,r,n,e,o){return Ot(e)||Ot(o)?b(Hr,function(t){switch(t.ctor){case"Black":return Lr;case"Red":return Or;case"NBlack":return Dr;default:return At.crash("Can't make a double black node more black!")}}(t),r,n,Dt(e),Dt(o)):b(Wr,t,r,n,e,o)}),Kr=t(function(t,r,n,e,o){var c=o;return"RBEmpty_elm_builtin"===c.ctor?v(Qr,t,e,o):b(Vr,t,r,n,e,b(Kr,c._0,c._1,c._2,c._3,c._4))}),Qr=s(function(t,r,n){r={ctor:"_Tuple2",_0:r,_1:n};if("RBEmpty_elm_builtin"!==r._0.ctor){if("RBEmpty_elm_builtin"===r._1.ctor){var e=r._1._0,o=r._0._0,c=o,u=e;return"_Tuple3"==="_Tuple3"&&"Black"===t.ctor&&"Red"===c.ctor&&"LBlack"===u.ctor?b(Wr,Or,r._0._1,r._0._2,r._0._3,r._0._4):d(Rr,"Black/Red/LBlack",t,A(o),A(e))}c=r._0._2,u=r._0._4,o=r._0._1,e=b(Kr,r._0._0,o,c,r._0._3,u),c=v(Mr,o,c,u),u=c._0,c=c._1;return b(Vr,t,u,c,e,n)}if("RBEmpty_elm_builtin"!==r._1.ctor){u=r._1._0,c=r._0._0,e=c,n=u;return"_Tuple3"==="_Tuple3"&&"Black"===t.ctor&&"LBlack"===e.ctor&&"Red"===n.ctor?b(Wr,Or,r._1._1,r._1._2,r._1._3,r._1._4):d(Rr,"Black/LBlack/Red",t,A(c),A(u))}switch(t.ctor){case"Red":return Jr(Fr);case"Black":return Jr(Ir);default:return At.crash("cannot have bblack or nblack nodes at this point")}}),$r=l(function(t,r){var n=r;if("RBEmpty_elm_builtin"===n.ctor)return Jr(Fr);r=n._1;return b(Wr,n._0,r,m(t,r,n._2),m($r,t,n._3),m($r,t,n._4))}),Xr={ctor:"Same"},Yr={ctor:"Remove"},Zr={ctor:"Insert"},tn=s(function(s,d,t){function p(t){var r=t;if("RBEmpty_elm_builtin"===r.ctor){t=d(P);return"Nothing"===t.ctor?{ctor:"_Tuple2",_0:Xr,_1:zr}:{ctor:"_Tuple2",_0:Zr,_1:b(Wr,Dr,s,t._0,zr,zr)}}var n=r._2,e=r._4,o=r._3,c=r._1,u=r._0;switch(m(L,s,c).ctor){case"EQ":var i=d(F(n));return"Nothing"===i.ctor?{ctor:"_Tuple2",_0:Yr,_1:v(Qr,u,o,e)}:{ctor:"_Tuple2",_0:Xr,_1:b(Wr,u,c,i._0,o,e)};case"LT":var _=p(o),a=_._0,f=_._1;switch(a.ctor){case"Same":return{ctor:"_Tuple2",_0:Xr,_1:b(Wr,u,c,n,f,e)};case"Insert":return{ctor:"_Tuple2",_0:Zr,_1:b(Hr,u,c,n,f,e)};default:return{ctor:"_Tuple2",_0:Yr,_1:b(Vr,u,c,n,f,e)}}default:var _=p(e),a=_._0,l=_._1;switch(a.ctor){case"Same":return{ctor:"_Tuple2",_0:Xr,_1:b(Wr,u,c,n,o,l)};case"Insert":return{ctor:"_Tuple2",_0:Zr,_1:b(Hr,u,c,n,o,l)};default:return{ctor:"_Tuple2",_0:Yr,_1:b(Vr,u,c,n,o,l)}}}}var r,n=p(t),t=n._0,e=n._1;switch(t.ctor){case"Same":return e;case"Insert":return"RBNode_elm_builtin"===(r=e).ctor&&"Red"===r._0.ctor?b(Wr,Or,r._1,r._2,r._3,r._4):r;default:return"RBEmpty_elm_builtin"===(r=e).ctor?Jr(Fr):b(Wr,Or,r._1,r._2,r._3,r._4)}}),rn=s(function(t,r,n){return v(tn,t,B(F(r)),n)}),nn=l(function(t,r){return v(rn,t,r,zr)}),en=l(function(t,r){return v(xr,rn,r,t)}),on=l(function(e,t){var r=s(function(t,r,n){return m(e,t,r)?v(rn,t,r,n):n});return v(xr,r,zr,t)}),cn=l(function(t,n){return m(on,l(function(t,r){return m(Cr,t,n)}),t)}),un=l(function(o,t){var r=s(function(t,r,n){var e=n._1,n=n._0;return m(o,t,r)?{ctor:"_Tuple2",_0:v(rn,t,r,n),_1:e}:{ctor:"_Tuple2",_0:n,_1:v(rn,t,r,e)}});return v(xr,r,{ctor:"_Tuple2",_0:zr,_1:zr},t)}),_n=l(function(t,r){return v(tn,t,B(P),r)}),an=l(function(t,r){return v(xr,s(function(t,r,n){return m(_n,t,n)}),t,r)}),fn=(At.crash,At.log),ln=l(function(t,r){return{ctor:"_Tuple2",_0:r._0,_1:t(r._1)}}),sn=(l(function(t,r){return{ctor:"_Tuple2",_0:t(r._0),_1:r._1}}),function(t){return t._1}),dn=function(t){return t._0},pn=(Pt={},It=l(function(t,r){return r}),Ft=l(function(r,n){return function(t){return r(n(t))}}),{sendToApp:l(function(r,n){return Bn.nativeBinding(function(t){r.main(n),t(Bn.succeed(g.Tuple0))})}),sendToSelf:l(function(t,r){return m(Bn.send,t.self,{ctor:"self",_0:r})}),effectManagers:Pt,outgoingPort:function(t,r){return wn(t),Pt[t]={tag:"cmd",cmdMap:It,converter:r,isForeign:!0},vn(t)},incomingPort:function(t,r){return wn(t),Pt[t]={tag:"sub",subMap:Ft,converter:r,isForeign:!0},vn(t)},htmlToProgram:function(t){var r=bn(U.Nil),n=g.Tuple2(g.Tuple0,r);return ui({init:n,view:function(t){return main},update:l(function(t,r){return n}),subscriptions:function(t){return r}})},program:function(n){return function(t){return function(t,r){t.worker=function(t){if(void 0!==t)throw new Error("The `"+r+"` module does not need flags.\nCall "+r+".worker() with no arguments and you should be all set!");return gn(n.init,n.update,n.subscriptions,hn)}}}},programWithFlags:function(e){return function(n){return function(t,r){t.worker=function(t){if(void 0===n)throw new Error("Are you trying to sneak a Never value into Elm? Trickster!\nIt looks like "+r+".main is defined with `programWithFlags` but has type `Program Never`.\nUse `program` instead if you do not want flags.");t=m(no.run,n,t);if("Err"===t.ctor)throw new Error(r+".worker(...) was called with an unexpected argument.\nI tried to convert it to an Elm value, but ran into this problem:\n\n"+t._0);return gn(e.init(t._0),e.update,e.subscriptions,hn)}}}},initialize:gn,leaf:vn,batch:bn,map:l(function(t,r){return{type:"map",tagger:t,tree:r}})});function hn(t,r){return function(t){}}function gn(o,c,u,i){var _,a={};var r=mn(Bn.nativeBinding(function(t){var r=o._0;_=i(f,r);var n=o._1,e=u(r);Tn(a,n,e),t(Bn.succeed(r))}),function(e,o){return Bn.nativeBinding(function(t){var r=m(c,e,o);o=r._0,_(o);var n=r._1,r=u(o);Tn(a,n,r),t(Bn.succeed(o))})});function f(t){Bn.rawSend(r,t)}var t=function(t,r){var n,e;for(e in Pt){var o=Pt[e];o.isForeign&&((n=n||{})[e]="cmd"===o.tag?function(t){var u=[],i=Pt[t].converter,_=Bn.succeed(null);return Pt[t].init=_,Pt[t].onEffects=s(function(t,r,n){for(;"[]"!==r.ctor;){for(var e=u,o=i(r._0),c=0;c",_1:{ctor:"[]"}}}}}}}}}}))})),ce={ctor:"NBlack"},ue={ctor:"BBlack"},ie={ctor:"Black"},_e=function(t){if("RBNode_elm_builtin"!==t.ctor)return!0;t=t._0;return g.eq(t,ie)||g.eq(t,ue)},ae={ctor:"Red"},fe=function(t){var r=t;switch(r.ctor){case"BBlack":return ie;case"Black":return ae;case"Red":return ce;default:return g.crashCase("AllDict",{start:{line:348,column:5},end:{line:352,column:75}},r)("Can't make a negative black node less black!")}},le={ctor:"LBBlack"},se={ctor:"LBlack"},de=l(function(t,r){return{ctor:"RBEmpty_elm_builtin",_0:t,_1:r}}),pe=function(t){return m(de,se,t)},he=t(function(t,r,n,e,o){return{ctor:"RBNode_elm_builtin",_0:t,_1:r,_2:n,_3:e,_4:o}}),ge=function(t){return"RBEmpty_elm_builtin"===t.ctor?g.crashCase("AllDict",{start:{line:486,column:5},end:{line:488,column:69}},t)("can't make a Leaf red"):b(he,ae,t._1,t._2,t._3,t._4)},me=t(function(t,r,n,e,o){return zn(b(he,t,r,n,e,o))}),ve=t(function(t,r,n,e,o){return Pn(e)||Pn(o)?b(me,function(t){var r=t;switch(r.ctor){case"Black":return ue;case"Red":return ie;case"NBlack":return ae;default:return g.crashCase("AllDict",{start:{line:339,column:5},end:{line:343,column:73}},r)("Can't make a double black node more black!")}}(t),r,n,Jn(e),Jn(o)):b(he,t,r,n,e,o)}),be=t(function(t,r,n,e,o){var c=o;return"RBEmpty_elm_builtin"===c.ctor?v(Te,t,e,o):b(ve,t,r,n,e,b(be,c._0,c._1,c._2,c._3,c._4))}),Te=s(function(t,r,n){var e={ctor:"_Tuple2",_0:r,_1:n};if("RBEmpty_elm_builtin"!==e._0.ctor){if("RBEmpty_elm_builtin"===e._1.ctor){var o=e._1._0,c=e._0._0,u=c,i=o;return"_Tuple3"==="_Tuple3"&&"Black"===t.ctor&&"Red"===u.ctor&&"LBlack"===i.ctor?b(he,ie,e._0._1,e._0._2,e._0._3,e._0._4):d(oe,"Black/Red/LBlack",t,Fn(c),In(o))}var _=e._0._2,a=e._0._4,u=e._0._3,i=e._0._1,c=e._0._0,o=b(be,c,i,_,u,a),n=b(he,e._1._0,e._1._1,e._1._2,e._1._3,e._1._4),u=function(t){for(;;){var r=t;if("RBNode_elm_builtin"!==r.ctor)return g.crashCase("AllDict",{start:{line:157,column:5},end:{line:165,column:51}},r)("(max Empty) is not defined");if("RBEmpty_elm_builtin"===r._4.ctor)return{ctor:"_Tuple2",_0:r._1,_1:r._2};t=r._4}}(r=b(he,c,i,_,u,a)),a=u._0,u=u._1;return b(ve,t,a,u,o,n)}if("RBEmpty_elm_builtin"!==e._1.ctor){a=e._1._0,u=e._0._0,o=u,n=a;return"_Tuple3"==="_Tuple3"&&"Black"===t.ctor&&"LBlack"===o.ctor&&"Red"===n.ctor?b(he,ie,e._1._1,e._1._2,e._1._3,e._1._4):d(oe,"Black/LBlack/Red",t,In(u),Fn(a))}var f=e._0._1;switch(t.ctor){case"Red":return m(de,se,f);case"Black":return m(de,le,f);default:return _eeue56$elm_all_dict$Native_Debug.crash("cannot have bblack or nblack nodes at this point")}}),ye=l(function(t,r){var n=r;if("RBEmpty_elm_builtin"===n.ctor)return m(de,n._0,n._1);r=n._1;return b(he,n._0,r,m(t,r,n._2),m(ye,t,n._3),m(ye,t,n._4))}),we={ctor:"Same"},ke={ctor:"Remove"},Se={ctor:"Insert"},xe=s(function(s,d,t){function p(t){var r=t;if("RBEmpty_elm_builtin"===r.ctor){t=d(P);return"Nothing"===t.ctor?{ctor:"_Tuple2",_0:we,_1:g}:{ctor:"_Tuple2",_0:Se,_1:b(he,ae,s,t._0,g,g)}}var n=r._2,e=r._4,o=r._3,c=r._1,u=r._0;switch(m(L,h(s),h(c)).ctor){case"EQ":var i=d(F(n));return"Nothing"===i.ctor?{ctor:"_Tuple2",_0:ke,_1:v(Te,u,o,e)}:{ctor:"_Tuple2",_0:we,_1:b(he,u,c,i._0,o,e)};case"LT":var _=p(o),a=_._0,f=_._1;switch(a.ctor){case"Same":return{ctor:"_Tuple2",_0:we,_1:b(he,u,c,n,f,e)};case"Insert":return{ctor:"_Tuple2",_0:Se,_1:b(me,u,c,n,f,e)};default:return{ctor:"_Tuple2",_0:ke,_1:b(ve,u,c,n,f,e)}}default:var _=p(e),a=_._0,l=_._1;switch(a.ctor){case"Same":return{ctor:"_Tuple2",_0:we,_1:b(he,u,c,n,o,l)};case"Insert":return{ctor:"_Tuple2",_0:Se,_1:b(me,u,c,n,o,l)};default:return{ctor:"_Tuple2",_0:ke,_1:b(ve,u,c,n,o,l)}}}}var r,h=te(t),g=pe(h),n=p(t),t=n._0,e=n._1;switch(t.ctor){case"Same":return e;case"Insert":return function(t){var r=t;t:do{if("RBNode_elm_builtin"!==r.ctor)break t;switch(r._0.ctor){case"Red":return b(he,ie,r._1,r._2,r._3,r._4);case"Black":return t;default:break t}}while(0);return t}(e);default:return"RBEmpty_elm_builtin"===(r=e).ctor?m(de,se,r._1):b(he,ie,r._1,r._2,r._3,r._4)}}),Be=s(function(t,r,n){return v(xe,t,B(F(r)),n)}),Re=s(function(t,r,n){return v(Be,r,n,pe(t))}),Ne=(l(function(t,r){return v(Xn,Be,r,t)}),l(function(t,r){return v(nt,l(function(t,r){return v(Be,t._0,t._1,r)}),pe(t),r)}),l(function(e,t){var r=s(function(t,r,n){return m(e,t,r)?v(Be,t,r,n):n});return v(Xn,r,pe(te(t)),t)})),Ae=(l(function(t,n){return m(Ne,l(function(t,r){return m(ee,t,n)}),t)}),l(function(o,t){var r=te(t),n=s(function(t,r,n){var e=n._1,n=n._0;return m(o,t,r)?{ctor:"_Tuple2",_0:v(Be,t,r,n),_1:e}:{ctor:"_Tuple2",_0:n,_1:v(Be,t,r,e)}});return v(Xn,n,{ctor:"_Tuple2",_0:pe(r),_1:pe(r)},t)}),l(function(t,r){return v(xe,t,B(P),r)})),qe=(l(function(t,r){return v(Xn,s(function(t,r,n){return m(Ae,t,n)}),t,r)}),Un=32,Wn=2,{empty:jn={ctor:"_Array",height:0,table:[]},fromList:function(t){if("[]"===t.ctor)return jn;for(var r=new Array(Un),n=[],e=0;"[]"!==t.ctor;)r[e]=t._0,t=t._1,++e===Un&&(Ce({ctor:"_Array",height:0,table:r},n),r=new Array(Un),e=0);0n.height?(r=Ue(r),e=t(Je(r),n),Me(r,e[0]),n=He(e[1],e[1].height+1)):(n=Ue(n),o=0===(e=t(r,ze(n)))[0].table.length?0:1,c=0==o?1:0,Ee(n,e[o]),r=He(e[c],e[c].height+1)))}if(0===r.table.length||0===n.table.length)return[r,n];var c=Le(r,n);if(c<=Wn)return[r,n];return Fe(r,n,c)}(t,r);if(n[0].table.length+n[1].table.length<=Un){if(0===n[0].table.length)return n[1];if(0===n[1].table.length)return n[0];if(n[0].table=n[0].table.concat(n[1].table),0=We(r))throw new Error("Index "+t+" is out of range. Check the length of your array first or use getMaybe or getWithDefault.");return function(t,r){for(var n=r.height;0>5*n;r.lengths[e]<=t;)e++;0>5*r.height;r.lengths[n]<=t;)n++;return n}function Ge(t,r){return 0===r?{ctor:"_Array",height:0,table:[t]}:{ctor:"_Array",height:r,table:[Ge(t,r-1)],lengths:[1]}}function He(t,r){return r===t.height?t:{ctor:"_Array",height:r,table:[He(t,r-1)],lengths:[We(t)]}}function Ve(t,r){return{ctor:"_Array",height:t.height+1,table:[t,r],lengths:[We(t),We(t)+We(r)]}}qe.append;var Ke,Qe=qe.length,$e=qe.slice,Xe=qe.set,Ye=l(function(t,r){return g.cmp(0,t)<1&&g.cmp(t,qe.length(r))<0?F(m(qe.get,t,r)):P}),Ze=(qe.push,qe.empty,l(function(n,t){var r=l(function(t,r){return n(t)?m(qe.push,t,r):r});return v(qe.foldl,r,qe.empty,t)}),qe.foldr,qe.foldl,qe.indexedMap,qe.map,qe.toList),to=qe.fromList,ro=qe.initialize,no=(l(function(t,r){return m(ro,t,B(r))}),{encode:l(function(t,r){return JSON.stringify(r,null,t)}),runOnString:l(function(t,r){var n;try{n=JSON.parse(r)}catch(t){return Vt("Given an invalid JSON: "+t.message)}return lo(t,n)}),run:l(lo),decodeNull:function(t){return{ctor:"",tag:"null",value:t}},decodePrimitive:function(t){return{ctor:"",tag:t}},decodeContainer:l(function(t,r){return{ctor:"",tag:t,decoder:r}}),decodeField:l(function(t,r){return{ctor:"",tag:"field",field:t,decoder:r}}),decodeIndex:l(function(t,r){return{ctor:"",tag:"index",index:t,decoder:r}}),map1:l(function(t,r){return eo(t,[r])}),map2:s(function(t,r,n){return eo(t,[r,n])}),map3:f(function(t,r,n,e){return eo(t,[r,n,e])}),map4:t(function(t,r,n,e,o){return eo(t,[r,n,e,o])}),map5:u(function(t,r,n,e,o,c){return eo(t,[r,n,e,o,c])}),map6:r(function(t,r,n,e,o,c,u){return eo(t,[r,n,e,o,c,u])}),map7:n(function(t,r,n,e,o,c,u,i){return eo(t,[r,n,e,o,c,u,i])}),map8:(Ke=function(t,r,n,e,o,c,u,i,_){return eo(t,[r,n,e,o,c,u,i,_])},ho.arity=9,ho.func=Ke,ho),decodeKeyValuePairs:function(t){return{ctor:"",tag:"key-value",decoder:t}},andThen:l(function(t,r){return{ctor:"",tag:"andThen",decoder:r,callback:t}}),fail:function(t){return{ctor:"",tag:"fail",msg:t}},succeed:function(t){return{ctor:"",tag:"succeed",msg:t}},oneOf:function(t){return{ctor:"",tag:"oneOf",decoders:t}},identity:function(t){return t},encodeNull:null,encodeArray:qe.toJSArray,encodeList:U.toArray,encodeObject:function(t){for(var r={};"[]"!==t.ctor;){var n=t._0;r[n._0]=n._1,t=t._1}return r},equality:so});function eo(t,r){return{ctor:"",tag:"map-many",func:t,decoders:r}}function oo(t){return{tag:"ok",value:t}}function co(t,r){return{tag:"primitive",type:t,value:r}}function uo(t,r){return{tag:"index",index:t,rest:r}}function io(t,r){return{tag:"field",field:t,rest:r}}function uo(t,r){return{tag:"index",index:t,rest:r}}function _o(t){return{tag:"oneOf",problems:t}}function ao(t){return{tag:"fail",msg:t}}function fo(t){for(var r,n="_";t;)switch(t.tag){case"primitive":return"Expecting "+t.type+("_"===n?"":" at "+n)+" but instead got: "+(void 0===(r=t.value)?"undefined":JSON.stringify(r));case"index":n+="["+t.index+"]",t=t.rest;break;case"field":n+="."+t.field,t=t.rest;break;case"oneOf":for(var e=t.problems,o=0;o=n.length?co("a longer array. Need index "+i+" but there are only "+n.length+" entries",n):"ok"===(d=t(r.decoder,n[i])).tag?d:uo(i,d):co("an array",n);case"key-value":if("object"!=typeof n||null===n||n instanceof Array)return co("an object",n);var _,a=U.Nil;for(_ in n){if("ok"!==(d=t(r.decoder,n[_])).tag)return io(_,d);var f=g.Tuple2(_,d.value);a=U.Cons(f,a)}return oo(a);case"map-many":for(var l=r.func,s=r.decoders,o=0;ou)return o}switch(n.type){case"tagger":for(var s=n.node;"tagger"===s.type;)s=s.node;return t(r,s,e,o,c+1,u,r.elm_event_node_ref);case"node":for(var d=n.children,p=r.childNodes,h=0;hu))return o;c=m}return o;case"keyed-node":for(d=n.children,p=r.childNodes,h=0;hu))return o;c=m}return o;case"text":case"thunk":throw new Error("should never traverse `text` or `thunk` nodes like this")}}(t,r,n,0,0,r.descendantsCount,e)}function Vu(t,r,n,e){return 0===n.length?t:(Hu(t,r,n,e),Ku(t,n))}function Ku(t,r){for(var n=0;nOops! Something went wrong when starting your Elm program.'+t+" "),new Error(t)}function Xu(e,o){return function(t,r){var n={tagger:t,parent:void 0},t=o(r),r=Iu(t,n);return e.appendChild(r),Yu(r,o,t,n)}}function Yu(n,e,t,o){var c,u="NO_REQUEST",i=t;function _(){switch(u){case"NO_REQUEST":throw new Error("Unexpected draw callback.\nPlease report this to .");case"PENDING_REQUEST":Wc(_),u="EXTRA_REQUEST";var t=e(c),r=Ju(i,t);return n=Vu(n,i,r,o),void(i=t);case"EXTRA_REQUEST":return void(u="NO_REQUEST")}}return function(t){"NO_REQUEST"===u&&Wc(_),u="PENDING_REQUEST",c=t}}function Zu(n){return Bn.nativeBinding(function(t){var r=n.doc;!r||(r=r.getElementsByClassName("debugger-sidebar-messages")[0])&&(r.scrollTop=r.scrollHeight),t(Bn.succeed(g.Tuple0))})}function ti(y,w,k,S,x,B){return function(t,r){var n={tagger:t,parent:void 0},e={tagger:t,parent:void 0},o=S(r),t=Iu(o,n);w.appendChild(t);var c=Yu(t,S,o,n),o=x(r)._1,r=Iu(o,e);w.appendChild(r);var u,i,_,a,f,l,n=(i=x,a=function(e){return function(t){if("keydown"!==t.type||!t.metaKey||82!==t.which){for(var r="scroll"===t.type||"wheel"===t.type,n=t.target;null!==n;){if("elm-overlay-message-details"===n.className&&r)return;if(n===e&&!r)return;n=n.parentNode}t.stopPropagation(),t.preventDefault()}}}(r),f="Normal",l=(u=n).tagger,function(t){var r=i(t),t=r._0.ctor;return u.tagger="Normal"===t?l:s,f!==t&&(ri("removeEventListener",a,f),ri("addEventListener",a,t),"Normal"===f&&(_=document.body.style.overflow,document.body.style.overflow="hidden"),"Normal"===t&&(document.body.style.overflow=_),f=t),r._1});function s(){}var d,p,h,g,m,v,b=Yu(r,n,o,e),T=(d=B,p=e,h=y,g=k,function(t){if(t.isDebuggerOpen){if(!g.doc)return m=d(t),void(v=function(t,r,n,e){var o=screen.width-900,c=screen.height-360,u=window.open("","","width=900,height=360,left="+o+",top="+c);Jc=u.document,(r.doc=Jc).title="Debugger - "+t,Jc.body.style.margin="0",Jc.body.style.padding="0";n=Iu(n,e);function i(){r.doc=void 0,u.close()}return Jc.body.appendChild(n),Jc.addEventListener("keydown",function(t){t.metaKey&&82===t.which&&window.location.reload(),38===t.which&&(e.tagger({ctor:"Up"}),t.preventDefault()),40===t.which&&(e.tagger({ctor:"Down"}),t.preventDefault())}),window.addEventListener("unload",i),u.addEventListener("unload",function(){r.doc=void 0,window.removeEventListener("unload",i),e.tagger({ctor:"Close"})}),Jc=document,n}(h,g,m,p));Jc=g.doc;var r=d(t),t=Ju(m,r);v=Vu(v,m,t,p),m=r,Jc=document}});return function(t){c(t),b(t),T(t)}}}function ri(t,r,n){switch(n){case"Normal":return;case"Pause":return ni(t,r,jc),0;case"Message":return ni(t,r,Gc),0}}function ni(t,r,n){for(var e=0;e"]=l(function(t,r){return m(i_,function(t){return r},t)});var ou=s(function(r,t,n){var e=t,t=m(qr,e.category,n);if("Nothing"===t.ctor)return f_(n);return m(N_["&>"],d_(m(ft,function(t){return m(Qn,r,t(e.position))},t._0.taggers)),f_(n))}),fi=f_(zr),A_=l(function(t,r){return"Nothing"===r.ctor?F({ctor:"::",_0:t,_1:{ctor:"[]"}}):F({ctor:"::",_0:t,_1:r._0})}),q_=l(function(t,r){for(;;){var n=t;if("[]"===n.ctor)return r;t=n._1,r=v(tn,n._0._0,A_(n._0._1),r)}}),C_=pn.leaf("Mouse"),su=l(function(t,r){return{x:t,y:r}}),M_=v(Co,su,m(Oo,"pageX",Po),m(Oo,"pageY",Po)),E_=l(function(t,r){return{taggers:t,pid:r}}),L_=l(function(t,r){return{category:t,position:r}}),ai=s(function(r,t,n){var e=s(function(n,e,t){var o=v(v_,n,M_,function(t){return m(Kn,r,m(L_,n,t))});return m(i_,function(r){return m(i_,function(t){return f_(v(rn,n,m(E_,e,t),r))},R_(o))},t)}),o=f(function(r,t,n,e){var o=t;return m(i_,function(t){return f_(v(rn,r,m(E_,n,o.pid),t))},e)}),c=s(function(t,r,n){return m(N_["&>"],B_(r.pid),n)});return p(Br,c,o,e,n,m(q_,t,zr),f_(zr))}),O_=l(function(t,r){return{ctor:"MySub",_0:t,_1:r}}),D_=function(t){return C_(m(O_,"mousemove",t))},P_=function(t){return C_(m(O_,"mouseup",t))},su=l(function(r,t){var n=t;return m(O_,n._0,function(t){return r(n._1(t))})});pn.effectManagers.Mouse={pkg:"elm-lang/mouse",init:fi,onEffects:ai,onSelfMsg:ou,tag:"sub",subMap:su};function I_(t){return Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"flex",_1:A(t)},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"width",_1:"100%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"height",_1:"100%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"overflow",_1:"hidden"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"boxSizing",_1:"border-box"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"position",_1:"relative"},_1:{ctor:"[]"}}}}}}})}function F_(t){return dn(dn(t))}function J_(t){return{ctor:"AtMost",_0:t}}function z_(r){return va(function(t){return m(Ao,r,t.body)})}var U_={ctor:"::",_0:{ctor:"_Tuple2",_0:"width",_1:"100%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"background",_1:"#000"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"boxSizing",_1:"border-box"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"opacity",_1:".2"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"zIndex",_1:"1"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"webkitUserSelect",_1:"none"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"mozUserSelect",_1:"none"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"userSelect",_1:"none"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"backgroundClip",_1:"padding-box"},_1:{ctor:"[]"}}}}}}}}}},W_=l(function(t,r){return"Horizontal"===t.ctor?{attributes:{ctor:"::",_0:Vi(m(N["++"],U_,m(N["++"],{ctor:"::",_0:{ctor:"_Tuple2",_0:"width",_1:"11px"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"height",_1:"100%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"margin",_1:"0 -5px"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"borderLeft",_1:"5px solid rgba(255, 255, 255, 0)"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"borderRight",_1:"5px solid rgba(255, 255, 255, 0)"},_1:{ctor:"[]"}}}}}},r?{ctor:"::",_0:{ctor:"_Tuple2",_0:"cursor",_1:"col-resize"},_1:{ctor:"[]"}}:{ctor:"[]"}))),_1:{ctor:"[]"}},children:{ctor:"[]"}}:{attributes:{ctor:"::",_0:Vi(m(N["++"],U_,m(N["++"],{ctor:"::",_0:{ctor:"_Tuple2",_0:"height",_1:"11px"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"width",_1:"100%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"margin",_1:"-5px 0"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"borderTop",_1:"5px solid rgba(255, 255, 255, 0)"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"borderBottom",_1:"5px solid rgba(255, 255, 255, 0)"},_1:{ctor:"[]"}}}}}},r?{ctor:"::",_0:{ctor:"_Tuple2",_0:"cursor",_1:"row-resize"},_1:{ctor:"[]"}}:{ctor:"[]"}))),_1:{ctor:"[]"}},children:{ctor:"[]"}}}),j_=function(t){var r="_Tuple4",n=t.x,e=t.y,o=t.touchX,c=t.touchY;t:do{if("_Tuple4"!==r)break t;if("Just"===o.ctor&&"Just"===c.ctor)return{x:o._0,y:c._0};if("Just"===n.ctor&&"Just"===e.ctor)return{x:n._0,y:e._0};break t}while(0);return{x:0,y:0}},G_=l(function(t,r){return m(Eu,m(Mu,r._0,t),r._1)}),H_=t(function(t,r,n,e,o){if("Horizontal"===t.ctor){var c=C(q(e)*F_(r)),c=F_(r)+q(n.x-c)/q(e);return m(G_,c,r)}e=C(q(o)*F_(r)),c=F_(r)+q(n.y-e)/q(o);return m(G_,c,r)}),V_=function(t){return m(Eu,t,m(qu,0,1))},K_=(l(function(t,r){return{paneWidth:t,paneHeight:r}}),l(function(t,r){return{x:t,y:r}}),l(function(t,r){return{attributes:t,children:r}}),h(qo,u(function(t,r,n,e,o,c){return{x:t,y:r,touchX:n,touchY:e,parentWidth:o,parentHeight:c}}),Lo(m(Oo,"clientX",Po)),Lo(m(Oo,"clientY",Po)),Lo(m(Do,{ctor:"::",_0:"touches",_1:{ctor:"::",_0:"0",_1:{ctor:"::",_0:"clientX",_1:{ctor:"[]"}}}},Po)),Lo(m(Do,{ctor:"::",_0:"touches",_1:{ctor:"::",_0:"0",_1:{ctor:"::",_0:"clientY",_1:{ctor:"[]"}}}},Po)),m(Do,{ctor:"::",_0:"currentTarget",_1:{ctor:"::",_0:"parentElement",_1:{ctor:"::",_0:"clientWidth",_1:{ctor:"[]"}}}},Po),m(Do,{ctor:"::",_0:"currentTarget",_1:{ctor:"::",_0:"parentElement",_1:{ctor:"::",_0:"clientHeight",_1:{ctor:"[]"}}}},Po))),Q_={ctor:"Horizontal"},$_={ctor:"NotDraggable"},X_=function(t){return{ctor:"Draggable",_0:t}},Y_=function(t){return{ctor:"State",_0:t}},su=(l(function(t,r){return Y_(g.update(r._0,{dragState:t?X_(P):$_}))}),l(function(t,r){return Y_(g.update(r._0,{orientation:t}))}),l(function(t,r){r=r._0;return Y_(g.update(r,{splitterPosition:m(Mu,r.splitterPosition,t)}))})),Z_=(l(function(t,r){r=r._0;return Y_(g.update(r,{splitterPosition:m(Cu,r.splitterPosition,t)}))}),s(function(t,r,n){var e=t._0,o=n._0,c={ctor:"_Tuple2",_0:o.dragState,_1:r};t:do{if("_Tuple2"!==c.ctor||"Draggable"!==c._0.ctor)break t;if("Nothing"===c._0._0.ctor){if("SplitterClick"!==c._1.ctor)break t;var u=c._1._0;return{ctor:"_Tuple2",_0:Y_(g.update(o,{dragState:X_(F({paneWidth:u.parentWidth,paneHeight:u.parentHeight}))})),_1:e.onResizeStarted}}switch(c._1.ctor){case"SplitterLeftAlone":return{ctor:"_Tuple2",_0:Y_(g.update(o,{dragState:X_(P)})),_1:e.onResizeEnded};case"SplitterMove":var i=b(H_,o.orientation,o.splitterPosition,c._1._0,c._0._0._0.paneWidth,c._0._0._0.paneHeight);return{ctor:"_Tuple2",_0:Y_(g.update(o,{splitterPosition:i})),_1:e.onResize(F_(i))};default:break t}}while(0);return{ctor:"_Tuple2",_0:Y_(o),_1:P}})),ta=function(t){return{ctor:"SplitterLeftAlone",_0:t}},ra=function(t){return{ctor:"SplitterMove",_0:t}},na=function(t){t=t._0.dragState;return"Draggable"===t.ctor&&"Just"===t._0.ctor?Gn({ctor:"::",_0:D_(ra),_1:{ctor:"::",_0:P_(ta),_1:{ctor:"[]"}}}):Hn},ea=function(t){return{ctor:"SplitterClick",_0:t}},oa=function(t){return{ctor:"UpdateConfig",_0:t}},ca=l(function(t,r){return v(Z_,oa({onResize:function(t){return P},onResizeStarted:P,onResizeEnded:P}),t,r)._0}),ua=l(function(t,r){return{ctor:"CustomSplitter",_0:m(vi,{ctor:"::",_0:(u=t,v($i,"mousedown",{preventDefault:!0,stopPropagation:!1},m(Mo,function(t){return u(ea(t))},K_))),_1:{ctor:"::",_0:(c=t,v($i,"touchstart",{preventDefault:!0,stopPropagation:!0},m(Mo,function(t){return c(ea(t))},K_))),_1:{ctor:"::",_0:(o=t,v($i,"touchend",{preventDefault:!0,stopPropagation:!0},m(Mo,function(t){return o(ta(j_(t)))},K_))),_1:{ctor:"::",_0:(e=t,v($i,"touchmove",{preventDefault:!0,stopPropagation:!0},m(Mo,function(t){return e(ra(j_(t)))},K_))),_1:{ctor:"::",_0:(n=t,v($i,"touchcancel",{preventDefault:!0,stopPropagation:!0},m(Mo,function(t){return n(ta(j_(t)))},K_))),_1:r.attributes}}}}},r.children)};var n,e,o,c,u}),ia=s(function(t,r,n){var e=t.splitter;return("Just"===e.ctor?e._0:m(ua,t.toMsg,m(W_,r,n)))._0}),_a=f(function(t,r,n,e){var o=t._0,t=e._0,e="Draggable"===t.dragState.ctor?v(ia,o,t.orientation,!0):v(ia,o,t.orientation,!1);return m(hi,{ctor:"::",_0:Oi("pane-container"),_1:{ctor:"::",_0:(o=g.eq(t.orientation,Q_),Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"overflow",_1:"hidden"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"display",_1:"flex"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"flexDirection",_1:o?"row":"column"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"justifyContent",_1:"center"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"alignItems",_1:"center"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"width",_1:"100%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"height",_1:"100%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"boxSizing",_1:"border-box"},_1:{ctor:"[]"}}}}}}}}})),_1:{ctor:"[]"}}},{ctor:"::",_0:m(hi,{ctor:"::",_0:Oi("pane-first-view"),_1:{ctor:"::",_0:I_(F_(t.splitterPosition)),_1:{ctor:"[]"}}},{ctor:"::",_0:r,_1:{ctor:"[]"}}),_1:{ctor:"::",_0:e,_1:{ctor:"::",_0:m(hi,{ctor:"::",_0:Oi("pane-second-view"),_1:{ctor:"::",_0:I_(1-F_(t.splitterPosition)),_1:{ctor:"[]"}}},{ctor:"::",_0:n,_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}})}),aa=function(t){return{ctor:"ViewConfig",_0:t}},qo={regex:function(t){return new RegExp(t,"g")},caseInsensitive:function(t){return new RegExp(t.source,"gi")},escape:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},contains:l(function(t,r){return null!==r.match(t)}),find:s(function(t,r,n){t="All"===t.ctor?1/0:t._0;for(var e,o=[],c=0,u=n,n=r.lastIndex,i=-1;c++=o)return t;for(var r=arguments.length-3,n=new Array(r);0"]=l(function(t,r){return m(i_,function(t){return r},t)});var qo=f_(zr),wa=l(function(t,r){return"Nothing"===r.ctor?F({ctor:"::",_0:t,_1:{ctor:"[]"}}):F({ctor:"::",_0:t,_1:r._0})}),ka=l(function(t,r){for(;;){var n=t;if("[]"===n.ctor)return r;t=n._1,r=v(tn,n._0._0,wa(n._0._1),r)}}),Sa=m(Oo,"keyCode",Po),xa=pn.leaf("Keyboard"),Ba=l(function(t,r){return{taggers:t,pid:r}}),Ra=l(function(t,r){return{category:t,keyCode:r}}),Lo=s(function(o,t,r){var n=s(function(n,e,t){return m(i_,function(r){return m(i_,function(t){return f_(v(rn,n,m(Ba,e,t),r))},R_(v(v_,n,Sa,function(t){return m(Kn,o,m(Ra,n,t))})))},t)}),e=f(function(t,r,n,e){return m(l_,m(rn,t,m(Ba,n,r.pid)),e)}),c=s(function(t,r,n){return m(ya["&>"],B_(r.pid),n)});return p(Br,c,e,n,r,m(ka,t,zr),f_(zr))}),Na=l(function(t,r){return{ctor:"MySub",_0:t,_1:r}}),Aa=function(t){return xa(m(Na,"keypress",t))},Po=l(function(r,t){var n=t;return m(Na,n._0,function(t){return r(n._1(t))})});pn.effectManagers.Keyboard={pkg:"elm-lang/keyboard",init:qo,onEffects:Lo,onSelfMsg:Do,tag:"sub",subMap:Po};var qo={size:Bn.nativeBinding(function(t){t(Bn.succeed({width:window.innerWidth,height:window.innerHeight}))})},qa=qa||{};qa["&>"]=l(function(t,r){return m(i_,function(t){return r},t)});var Lo=s(function(r,n,t){var e=t;if("Nothing"===e.ctor)return f_(t);return m(qa["&>"],d_(m(ft,function(t){return m(Qn,r,t._0(n))},e._0.subs)),f_(t))}),Do=f_(P),Ca=qo.size,Ma=(m(l_,function(t){return t.width},Ca),m(l_,function(t){return t.height},Ca)),Po=s(function(r,n,t){t={ctor:"_Tuple2",_0:t,_1:n};return"Nothing"===t._0.ctor?"[]"===t._1.ctor?f_(P):m(i_,function(t){return f_(F({subs:n,pid:t}))},R_(v(m_,"resize",Ro({ctor:"_Tuple0"}),function(t){return m(i_,Kn(r),Ca)}))):"[]"===t._1.ctor?m(qa["&>"],B_(t._0._0.pid),f_(P)):f_(F({subs:n,pid:t._0._0.pid}))}),Ea=(pn.leaf("Window"),l(function(t,r){return{width:t,height:r}}),function(t){return{ctor:"MySub",_0:t}}),qo=l(function(r,t){var n=t;return Ea(function(t){return r(n._0(t))})});pn.effectManagers.Window={pkg:"elm-lang/window",init:Do,onEffects:Po,onSelfMsg:Lo,tag:"sub",subMap:qo};var La,Do=(La=g.chr,{isSubString:t(function(t,r,n,e,o){var c=t.length;if(o.length-r=n.length?-1:55296==(63488&n.charCodeAt(r))?t(La(n.substr(r,2)))?r+2:-1:(n=n[r],t(La(n))?"\n"===n?-2:r+1:-1)}),findSubString:u(function(t,r,n,e,o,c){var u=c.indexOf(r,n);if(-1===u)return Oa(-1,e,o);for(var i=t?u:u+r.length;n."):m(Za,t._0,{source:r,offset:i,indent:o,context:c,row:n,col:u+(i-e)})}),{ctor:"BadInt"}),Pf=Xa(function(t){var r=t.source,n=t.row,e=t.offset,o=t.indent,c=t.context,u=t.col,t=v(ef,e,v(Ga,Ua,e,r),r);if("Err"===t.ctor){var i=t._0;return m(Ya,Df,{source:r,offset:i,indent:o,context:c,row:n,col:u+(i-e)})}i=t._0,t=rr(v(lr,e,i,r));return"Err"===t.ctor?g.crashCase("Parser",{start:{line:638,column:9},end:{line:650,column:16}},t)("The `Parser.int` parser seems to have a bug.\nPlease report an SSCCE to ."):m(Za,t._0,{source:r,offset:i,indent:o,context:c,row:n,col:u+(i-e)})}),If=s(function(t,r,n){for(;;){var e=n;if("[]"===e.ctor)return m(Ya,{ctor:"BadOneOf",_0:dt(r)},t);var o=e._0._0(t);if("Good"===o.ctor)return o;if(!g.eq(t.row,o._1.row)||!g.eq(t.col,o._1.col))return o;t=t,r={ctor:"::",_0:o._0,_1:r},n=e._1}}),Ff=function(r){return Xa(function(t){return v(If,t,{ctor:"[]"},r)})},Jf=function(t){return{ctor:"Exactly",_0:t}},Po=function(t){return{ctor:"AtLeast",_0:t}},zf=Po(0),Uf=Po(1),Wf=(m(Ef,zf,function(t){return g.eq(t,g.chr(" "))||g.eq(t,g.chr("\n"))||g.eq(t,g.chr("\r"))}),l(function(t,r){return r})),jf=l(function(t,r){return v(af,Wf,t,r)}),Gf=Gf||{};Gf["|-"]=jf;function Hf(t){var r=t,t=r.spaces;return m(Gf["|-"],m(Gf["|-"],xf(r.start),t),b(Xf,r.end,t,r.item,r.separator,r.trailing))}var Vf,Kf=t(function(r,n,e,o,c){return Ff({ctor:"::",_0:m(uf,function(t){return b(Kf,r,n,e,o,{ctor:"::",_0:t,_1:c})},m(ff["|."],m(ff["|."],m(ff["|."],e,n),xf(o)),n)),_1:{ctor:"::",_0:m(Gf["|-"],xf(r),pf(dt(c))),_1:{ctor:"[]"}}})}),Qf=t(function(r,n,e,o,c){return m(jf,n,Ff({ctor:"::",_0:m(Gf["|-"],m(Gf["|-"],xf(o),n),m(uf,function(t){return b(Qf,r,n,e,o,{ctor:"::",_0:t,_1:c})},e)),_1:{ctor:"::",_0:m(Gf["|-"],xf(r),pf(dt(c))),_1:{ctor:"[]"}}}))}),$f=t(function(r,n,e,o,c){var t=m(uf,function(t){return pf(dt(c))},xf(r));return m(jf,n,Ff({ctor:"::",_0:m(Gf["|-"],m(Gf["|-"],xf(o),n),Ff({ctor:"::",_0:m(uf,function(t){return b($f,r,n,e,o,{ctor:"::",_0:t,_1:c})},e),_1:{ctor:"::",_0:t,_1:{ctor:"[]"}}})),_1:{ctor:"::",_0:t,_1:{ctor:"[]"}}}))}),Xf=t(function(r,n,e,o,c){return Ff({ctor:"::",_0:m(uf,function(t){switch(c.ctor){case"Forbidden":return b(Qf,r,n,e,o,{ctor:"::",_0:t,_1:{ctor:"[]"}});case"Optional":return b($f,r,n,e,o,{ctor:"::",_0:t,_1:{ctor:"[]"}});default:return m(Gf["|-"],m(Gf["|-"],m(Gf["|-"],n,xf(o)),n),b(Kf,r,n,e,o,{ctor:"::",_0:t,_1:{ctor:"[]"}}))}},e),_1:{ctor:"::",_0:m(Gf["|-"],xf(r),pf({ctor:"[]"})),_1:{ctor:"[]"}}})}),Yf=f(function(r,n,e,o){return Wa(function(t){return m(jf,m(Ef,zf,r),Ff({ctor:"::",_0:m(jf,xf(e),g.eq(o,1)?pf({ctor:"_Tuple0"}):d(Yf,r,n,e,o-1)),_1:{ctor:"::",_0:m(jf,xf(n),d(Yf,r,n,e,o+1)),_1:{ctor:"::",_0:m(jf,m(Ef,Jf(1),sf),d(Yf,r,n,e,o)),_1:{ctor:"[]"}}}}))})}),Zf=(l(function(t,r){var n={ctor:"_Tuple2",_0:vr(t),_1:vr(r)};if("Nothing"===n._0.ctor)return bf("Trying to parse a multi-line comment, but the start token cannot be the empty string!");if("Nothing"===n._1.ctor)return bf("Trying to parse a multi-line comment, but the end token cannot be the empty string!");return m(ff["|."],xf(t),d(Yf,function(t){return!g.eq(t,n._0._0._0)&&!g.eq(t,n._1._0._0)},t,r,1))}),r(function(t,r,n,e,o,c,u){for(;;){var i=v(Ga,t,r,o);if(g.eq(i,-1))return{source:o,offset:r,indent:c,context:u,row:n,col:e};u=(c=(o=(e=g.eq(i,-2)?(t=t,r=r+1,n=n+1,1):(t=t,r=i,n=n,e+1),o),c),u)}})),Lo=s(function(_,a,f){return Xa(function(t){var r=t,n=r,e=r.source,o=r.row,c=r.offset,u=r.indent,i=r.context,t=v(Ga,_,c,e);if(g.eq(t,-1))return m(Ya,wf,n);i=g.eq(t,-2)?h(Zf,a,c+1,o+1,1,e,u,i):h(Zf,a,t,o,r.col+1,e,u,i),e=v(lr,c,i.offset,e);return m(Uo,e,f)?m(Ya,wf,n):m(Za,e,i)})}),tl={ctor:"Forbidden"},rl=(l(function(t,r){return Hf({start:"[",separator:",",end:"]",spaces:t,item:r,trailing:tl})}),l(function(t,r){return Hf({start:"{",separator:",",end:"}",spaces:t,item:r,trailing:tl})}),l(function(t,r){return Hf({start:"(",separator:",",end:")",spaces:t,item:r,trailing:tl})}),l(function(t,r){return{ctor:"UnnestableComment",_0:t,_1:r}}),l(function(t,r){return{ctor:"NestableComment",_0:t,_1:r}}),Xa(function(t){return m(Za,t.source,t)}),Xa(function(t){return m(Za,t.offset,t)}),Xa(function(t){return m(Za,t.col,t)}),Xa(function(t){return m(Za,t.row,t)}),Xa(function(t){return m(Za,{ctor:"_Tuple2",_0:t.row,_1:t.col},t)})),nl=l(function(t,r){return{source:r.source,offset:r.offset,indent:t,context:r.context,row:r.row,col:r.col}});l(function(n,t){var e=t;return Xa(function(t){var r=e._0(m(nl,n,t));return"Good"===r.ctor?m(Za,r._0,m(nl,t.indent,r._1)):m(Ya,r._0,m(nl,t.indent,r._1))})}),Xa(function(t){return m(Za,t.indent,t)});function el(){return{theme:null,mode:null,value:null,shared:null,showPrintMargin:!0,highlightActiveLine:!0,tabSize:4,useSoftTabs:!0,useWrapMode:!0,readOnly:!1,showCursor:!0,showGutter:!0,extensions:[]}}function ol(t,r){var n=t.model,e=r.model,o=n.shared,t=o.editor,r=t.getSession();return n.theme!=e.theme&&t.setTheme("ace/theme/"+e.theme),n.mode!=e.mode&&r.setMode("ace/mode/"+e.mode),o.skipNext||e.value==t.getValue()||(r=t.getCursorPositionScreen(),null!=e.value&&t.setValue(e.value,r)),o.skipNext=!1,e.shared=o,null}function cl(t){switch(t.ctor){case"Left":return g.chr("L");case"Right":return g.chr("R");default:return g.chr("S")}}function ul(t){return os(l(function(t,r){return g.eq(t,r)})(t))}function il(t){return gs(m(ft,function(t){return Tr(t)},zo(t)))}function _l(t){return m(Os,t,Au)}function al(t){return Wo(t)?zs:gs(zo(t))}function fl(t){return!0}function ll(e){return m(uf,function(t){var r=Ko(e),n=Ko(Zt(t)),r=m(Yo,n,r);return Wo(r)?pf(t):bf(m(N["++"],"second input to transition contains symbols not in alphabet: ",hs(r)))},m(ff["|="],pf(R),m(Lf,zf,function(t){return!m(ct,t,{ctor:"::",_0:g.chr(" "),_1:{ctor:"::",_0:g.chr("\n"),_1:{ctor:"::",_0:g.chr("\t"),_1:{ctor:"::",_0:g.chr("-"),_1:{ctor:"[]"}}}}})})))}function sl(t){return m(J,function(t){return t._0},vr(t._0.unscannedOutSyms))}function dl(t){var r=t._0;return"Nothing"===(t=vr(r.unscannedOutSyms)).ctor?g.crashCase("CFG",{start:{line:164,column:5},end:{line:176,column:18}},t)("advanceRow should not be called on a row with no symbols left to scan"):N0(g.update(r,{rule:r.rule,scannedOutSyms:m(br,t._0._0,r.scannedOutSyms),unscannedOutSyms:t._0._1,inputStartPos:r.inputStartPos,previous:F(N0(r))}))}function pl(t){return m(T1,t,Au)}function hl(t){var r=dt(t.right);return"[]"!==r.ctor?g.update(t,{right:dt(r._1)}):"[]"===(r=t.left).ctor?t:v(Gl,r._1,r._0,{ctor:"[]"})}function gl(t){var r=t.right;return"[]"===r.ctor?t:v(Gl,{ctor:"::",_0:t.cur,_1:t.left},r._0,r._1)}function ml(t){var r=t.left;return"[]"===r.ctor?t:v(Gl,r._1,r._0,{ctor:"::",_0:t.cur,_1:t.right})}function vl(t){return ut(t.right)}function bl(t){return g.update(t,{right:m(N["++"],t.right,{ctor:"::",_0:K1,_1:{ctor:"[]"}})})}function Tl(t){return{ctor:"SetOfStrings",_0:t}}function yl(t){return Yt(m(ft,function(t){return t.cur},t.tapes))}function wl(t){return{embedded:t.embedded,input:t.input,automatonText:t.automatonText,automatonTypeString:zd(t.automatonType),editorOptions:t.editorOptions}}function kl(t){var r=function(){switch(t.automatonType.ctor){case"DFAType":return m($t,hp,Z0(t.automatonText));case"NFAType":return m($t,pp,A1(t.automatonText));case"TMType":return m($t,lp,md(t.automatonText));case"CFGType":return m($t,dp,R0(t.automatonText));default:return m($t,sp,j1(t.automatonText))}}();return"Err"===r.ctor?g.update(t,{errorMsg:r._0,automaton:fp,resultModel:bp,accepted:P}):qp(g.update(t,{automaton:r._0}))}var Sl,xl,Bl,Rl,Nl=(Vf={render:function(t){var r,n={editor:null,skipNext:!1},e=document.createElement("div");for(r in e.setAttribute("class","elm-ace"),t.extensions)ace.require("ace/ext/"+r);var o=ace.edit(e);(n.editor=o).$blockScrolling=1/0,o.setOptions({showPrintMargin:t.showPrintMargin,highlightActiveLine:t.highlightActiveLine,readOnly:t.readOnly,showGutter:t.showGutter,fontSize:"12pt"}),t.showCursor||(o.renderer.$cursorLayer.element.style.display="none");o.getSession().setTabSize(t.tabSize),o.getSession().setUseSoftTabs(t.useSoftTabs),o.getSession().setUseWrapMode(t.useWrapMode),o.getSession().setValue(t.value||"");var c=el();c.shared=n,ol({model:c},{model:t}),o.setAutoScrollEditorIntoView(!0);return o.on("change",function(n,e,o){var c;return function(){var t=this,r=arguments;c?clearTimeout(c):o&&n.apply(t,r),c=setTimeout(function(){o||n.apply(t,r),c=null},e||100)}}(function(t){var r=o.getSession().getValue();e.value=r;r=new Event("AceSourceChange");n.skipNext=!0,e.dispatchEvent(r),e.value=null},150,!1)),e},diff:ol},{toHtml:l(function(t,r){var n=function(t){var r=el(),n=t;for(;"[]"!=n.ctor;){var e=n._0;switch(e.key){case"AceTheme":r.theme=e.value;break;case"AceMode":r.mode=e.value;break;case"AceValue":r.value=e.value;break;case"AceShowPrintMargin":r.showPrintMargin=e.value;break;case"AceHighlightActiveLine":r.highlightActiveLine=e.value;break;case"AceTabSize":r.tabSize=e.value;break;case"AceUseSoftTabs":r.useSoftTabs=e.value;break;case"AceUseWrapMode":r.useWrapMode=e.value;break;case"AceReadOnly":r.readOnly=e.value;break;case"AceShowCursor":r.showCursor=e.value;break;case"AceShowGutter":r.showGutter=e.value;break;case"AceEnableBasicAutocompletion":r.enableBasicAutocompletion=e.value;break;case"AceEnableLiveAutocompletion":r.enableLiveAutocompletion=e.value;break;case"AceEnableSnippets":r.enableSnippets=e.value;break;case"AceExtensions":r.extensions=e.value}n=n._1}return r}(t);return Lu.custom(t,n,Vf)})}).toHtml,Al=function(t){return m(Xi,"AceSourceChange",m(Mo,t,Qi))},ql=function(t){return m(Ei,"AceUseWrapMode",yo(t))},Cl=function(t){return m(Ei,"AceUseSoftTabs",yo(t))},Ml=function(t){return m(Ei,"AceShowPrintMargin",yo(t))},El=function(t){return m(Ei,"AceValue",wo(t))},Ll=function(t){return m(Ei,"AceMode",wo(t))},Ol=function(t){return m(Ei,"AceTheme",wo(t))},qo={fromStringWith:l(function(t,r){var n="g";t.multiline&&(n+="m"),t.caseInsensitive&&(n+="i");try{return Qt(new RegExp(r,n))}catch(t){return Vt(t.message)}}),contains:l(function(t,r){return null!==r.match(t)}),find:s(function(t,r,n){t="All"===t.ctor?1/0:t._0;for(var e,o=[],c=0,u=n,n=r.lastIndex,i=-1;c++=o)return t;for(var r=arguments.length-3,n=new Array(r);0",m(Ye,r-1,t))},_1:{ctor:"[]"}};var e=n._0;return m(ft,function(t){return{ctor:"_Tuple2",_0:t._0+e.row,_1:t._1}},(t=v($e,e.row-1,r,t),v(Y,l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}}),m(Rt,0,qe.length(t)-1),qe.toList(t))))}),u0=function(t){t=m(ft,function(t){return 5*t},m(Rt,1,t/5|0));return m(N["++"],"1 ",m(dr,"",m(ft,function(t){return v(ir,5,g.chr(" "),A(t))},t)))},i0=function(t){return m(N["++"],m(sr,t-1," "),Ws)},_0=function(t){return"[]"===t.ctor?P:F(m(N["++"],m(sr,t._0.col-1," "),js))},a0=l(function(t,r){var n=m(hf,t,r);if("Ok"===n.ctor)return Qt(n._0);var e=n._0.row,o=n._0.problem,c=n._0.context,u=n._0.col,t=(i={row:e,col:u,source:n._0.source,problem:o,context:c},a=(_=i).context,t=i0(_.col),r=_0(a),n="Nothing"===r.ctor?{ctor:"_Tuple2",_0:{ctor:"[]"},_1:{ctor:"[]"}}:{ctor:"_Tuple2",_0:{ctor:"::",_0:"parsing start",_1:{ctor:"[]"}},_1:{ctor:"::",_0:r._0,_1:{ctor:"[]"}}},i=n._0,r=n._1,n=v(c0,_.source,_.row,a),_=bt(n),a=_._0,n=_._1,_=m(D,1,ot(m(ft,function(t){return gr(t)},n))),_=u0(_),a=m(ft,function(t){return m(N["++"],"line ",A(t))},a),m(Js,0,m(Es,m(N["++"],{ctor:"::",_0:"column",_1:{ctor:"[]"}},m(N["++"],i,m(N["++"],a,{ctor:"::",_0:"error found",_1:{ctor:"[]"}}))),m(N["++"],{ctor:"::",_0:_,_1:{ctor:"[]"}},m(N["++"],r,m(N["++"],n,{ctor:"::",_0:t,_1:{ctor:"[]"}})))))),o=m(N["++"],"Error at line ",m(N["++"],m(o0,e,u),m(N["++"],"\n\n",m(N["++"],t,m(N["++"],"\n\n",A(o)))))),c=c;if("::"!==c.ctor)return Vt(o);var i,_,a,c=c._0;return Vt(m(N["++"],o,m(N["++"],"\n\nThis occurred when attempting to read ",m(N["++"],c.description,m(N["++"]," starting at line ",m(o0,c.row,c.col))))))}),f0=";",l0=(xl=Sl={allowTabs:!0,lineComment:{ctor:"LineComment",_0:"//"},multiComment:{ctor:"NoMultiComment"}},Bl=function(){var t=xl.multiComment;switch(t.ctor){case"NoMultiComment":return{ctor:"[]"};case"UnnestableComment":return{ctor:"::",_0:m(ff["|."],xf(t._0),yf(t._1)),_1:{ctor:"[]"}};default:return{ctor:"::",_0:m(Xs,t._0,t._1),_1:{ctor:"[]"}}}}(),Sl="NoLineComment"===(Sl=xl.lineComment).ctor?{ctor:"[]"}:{ctor:"::",_0:m(ff["|."],xf(Sl._0),yf("\n")),_1:{ctor:"[]"}},m(Zs,xl.allowTabs,Ff(m(N["++"],Sl,Bl)))),Po=Hf({start:"{",separator:",",end:"}",spaces:l0,item:r0,trailing:tl}),s0=l(function(t,r){return Hf({start:"{",separator:",",end:"}",spaces:l0,item:m(n0,t,r),trailing:tl})}),d0=function(t){return Ht(t)||Gt(t)||jt(t)||m(or,Tr(t),"/`~!@$%^&*()-_=+[]:;'.<>#|?\"\\")},qo=function(t){return d0(t)&&!g.eq(t,g.chr(";"))&&!g.eq(t,g.chr("|"))},Xt=m(mf,"the symbol",m(ff["|="],pf(t0),m(Lf,Jf(1),qo))),p0=m(mf,"the symbol",m(ff["|="],pf(t0),m(Lf,Jf(1),d0))),Do=Hf({start:"{",separator:",",end:"}",spaces:l0,item:p0,trailing:tl}),h0=(m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],pf(l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}})),l0),lf("states:")),l0),m(mf,"the set of states",Po)),l0),lf("input_alphabet:")),l0),m(mf,"the input alphabet",Do)),l0),l(function(t,n){return m(uf,function(t){var r=Ko(t),r=m(Yo,n,r);if(Wo(r))return pf(t);t=g.eq(mo(r),1)?"symbol":"symbols";return bf(m(N["++"],"missing required ",m(N["++"],t,m(N["++"],": ",hs(r)))))},Hf({start:"{",separator:",",end:"}",spaces:l0,item:(r=t,m(mf,"the symbol",m(uf,function(t){return m(Uo,t,r)?bf(m(N["++"],"symbol is not allowed to be ",Tr(t))):pf(t)},m(ff["|="],pf(t0),m(Lf,Jf(1),d0))))),trailing:tl}));var r})),g0="=",qo=m(mf,"the production rule output string ",Ff({ctor:"::",_0:v(Lo,qo,qo,Go),_1:{ctor:"::",_0:pf(""),_1:{ctor:"[]"}}})),qo=m(mf,"the production rule output list",Hf({start:"",separator:"|",end:f0,spaces:l0,item:qo,trailing:tl})),Xt=m(mf,"the production rule input symbol",Xt),m0=m(uf,function(t){return pf(m(ft,Wl(t._0),t._1))},m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],pf(l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}})),Xt),l0),xf("->")),l0),qo)),v0=function(r){return Ff({ctor:"::",_0:m(uf,function(t){return v0(m(N["++"],r,t))},m(ff["|."],m(ff["|="],m(ff["|."],pf(R),l0),m(mf,"the production rule",m0)),l0)),_1:{ctor:"::",_0:pf(r),_1:{ctor:"[]"}}})},qo=m(ff["|."],m(ff["|="],pf(R),v0({ctor:"[]"})),Rf),b0=m(df,function(t){var r=t;if("[]"===r.ctor)return d(Ul,g.chr("S"),{ctor:"::",_0:g.chr("S"),_1:{ctor:"[]"}},{ctor:"[]"},{ctor:"[]"});var n=Ns(m(mt,function(t){return Zt(t.outSymbols)},t)),e=Ns(m(ft,function(t){return t.inSymbol},t)),o=Ko(e),n=m(lt,function(t){return!m(Uo,t,o)},n);return d(Ul,r._0.inSymbol,e,n,t)},qo),T0=function(t){return m(a0,b0,t)},y0={rule:{inSymbol:g.chr("S"),outSymbols:""},scannedOutSyms:"",unscannedOutSyms:"",inputStartPos:0,completing:P,previous:P},w0=l(function(t,r){t=t._0,r=r._0;return g.eq(t.rule,r.rule)&&g.eq(t.scannedOutSyms,r.scannedOutSyms)&&g.eq(t.unscannedOutSyms,r.unscannedOutSyms)&&g.eq(t.inputStartPos,r.inputStartPos)}),k0=l(function(r,t){var n=t._0,e=function(){if(r){var t=n.completing;return"Nothing"===t.ctor?"":m(N["++"],"completing: ",m(k0,!0,t._0))}return""}(),t=function(){if(r){var t=n.previous;return"Nothing"===t.ctor?"":m(N["++"],"previous: ",m(k0,!0,t._0))}return""}();return m(N["++"],"(",m(N["++"],Tr(n.rule.inSymbol),m(N["++"]," -> ",m(N["++"],hr(n.scannedOutSyms),m(N["++"],";",m(N["++"],n.unscannedOutSyms,m(N["++"],", ",m(N["++"],A(n.inputStartPos),m(N["++"],", ",m(N["++"],t,m(N["++"],", ",m(N["++"],e,")"))))))))))))}),S0=l(function(t,r){return m(N["++"]," [\n ",m(N["++"],m(dr,"\n , ",m(ft,k0(t),r)),"\n ]"))}),x0=l(function(t,r){return m(N["++"],"[\n",m(N["++"],m(dr,"\n, ",m(ft,S0(t),r)),"\n]"))}),B0=(l(function(t,r){return m(x0,t,Ze(r))}),s(function(t,r,n){var e=n,o=e._1,c=et(o),u=0 ",m(N["++"],r._0._0,m(N["++"]," at line ",m(o0,r._0._1,r._0._2)))))))},m(ff["|."],m(mf,"the transition input symbol",ll(r)),l0))},m(ff["|."],m(ff["|."],m(ff["|."],m(mf,"the transition input state",m(n0,t,"state set")),l0),xf(",")),l0))})),G0=s(function(n,t,r){return m(uf,function(t){var r=t;return m(uf,function(t){return pf({ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:r._0,_1:r._1},_1:t})},m(ff["|."],m(ff["|."],m(mf,"the transition output state",m(n0,n,"state set")),l0),xf(f0)))},m(ff["|."],m(ff["|."],m(ff["|."],m(mf,"the transition inputs",v(j0,n,t,r)),l0),xf("->")),l0))}),H0=f(function(c,u,i,_){return Ff({ctor:"::",_0:m(uf,function(t){var o=t;return m(uf,function(t){var r=t._1,n=t._0._0,e=t._0._1,t={ctor:"::",_0:{ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:n,_1:e},_1:r},_1:_},r=v(Ru,{ctor:"_Tuple2",_0:n,_1:e},{ctor:"_Tuple3",_0:r,_1:o._0,_2:o._1},i);return d(H0,c,u,r,t)},m(ff["|."],m(mf,"the transition",v(G0,c,u,i)),l0))},rl),_1:{ctor:"::",_0:pf(dt(_)),_1:{ctor:"[]"}}})}),V0=s(function(t,r,n){r=Ko(m(Cs,t,r)),n=m(Qo,function(t){return{ctor:"_Tuple2",_0:t._0._0,_1:t._0._1}},Ko(n));return m(Yo,r,n)}),K0=l(function(n,e){return m(uf,function(t){var r=v(V0,n,e,t);return Wo(r)?pf(t):bf(m(N["++"],"the following inputs are not specified for delta: ",m(dr," ",m(ft,function(t){return v(ds,t._0,t._1,!0)},zo(r)))))},m(ff["|="],pf(R),d(H0,n,e,Au,{ctor:"[]"})))}),Q0=l(function(t,r){return m(df,_l,m(K0,t,r))}),$0=m(uf,function(t){var r=t._0,n=t._1;return m(uf,function(t){return pf(b(Jl,r,n,t._0,t._1,t._2))},m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(s(function(t,r,n){return{ctor:"_Tuple3",_0:t,_1:r,_2:n}})),lf("start_state")),l0),xf(g0)),l0),m(mf,"the start state",m(n0,r,"state set"))),l0),lf("accept_states")),l0),xf(g0)),l0),m(mf,"the set of accept states",m(s0,r,"state set"))),l0),lf("delta")),l0),xf(g0)),l0),m(mf,"the transition function delta",m(Q0,r,n))),l0),Rf))},m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}})),l0),lf("states")),l0),xf(g0)),l0),m(mf,"the set of states",Po)),l0),lf("input_alphabet")),l0),xf(g0)),l0),m(mf,"the input alphabet",Do)),l0)),X0=function(t){return m(a0,$0,t)},Y0=function(e){var t=m(es,e.states,e.inputAlphabet),t=m(ft,function(t){var r=t._1,n=t._0,t=m(D,"NO_STATE_FOUND",v(Ds,n,r,e.delta));return m(N["++"],n,m(N["++"],",",m(N["++"],Tr(r),m(N["++"]," -> ",m(N["++"],t,";")))))},t);return m(dr,"\n",m(ft,function(t){return m(N["++"]," ",t)},t))},Z0=function(t){return X0(t)},t1=s(function(t,r,n){return v(Ds,r,n,t.delta)}),r1=l(function(t,r){return m(N["++"],"No transition specified for state ",m(N["++"],t,m(N["++"]," and symbol ",Tr(r))))}),n1=s(function(t,r,n){var e=vr(n);if("Nothing"===e.ctor)return Qt({ctor:"::",_0:r,_1:{ctor:"[]"}});var o=e._0._0;return m($t,function(t){return{ctor:"::",_0:r,_1:t}},"Just"===(n=m(t,r,o)).ctor?v(n1,t,n._0,e._0._1):Vt(m(r1,r,o)))}),e1=l(function(r,n){return m(Kt,function(t){return v(n1,t1(r),r.startState,n)},m(ys,r.inputAlphabet,n))}),o1=s(function(t,r,n){return m(Kt,function(t){t=dt(t);return"[]"===t.ctor?Vt("This should be unreachable since statesVisitedFrom returns a positive-length list"):Qt(t._0)},v(n1,t,r,n))}),c1=(l(function(r,n){return m(Kt,function(t){return m($t,function(t){return m(ct,t,r.acceptStates)},v(o1,t1(r),r.startState,n))},m(ys,r.inputAlphabet,n))}),f(function(t,r,n,e){for(;;){var o=r;if("[]"===o.ctor)return{ctor:"_Tuple2",_0:n,_1:e};var c=o._0,u=m(Yo,c,t),i=m(Xo,t,c);e=Wo(i)||Wo(u)?(t=t,r=o._1,n=n,e):(o=m(Is,c,n),o={ctor:"::",_0:i,_1:{ctor:"::",_0:u,_1:o}},m(ct,c,e)?(c=m(Is,c,e),t=t,n=r=o,{ctor:"::",_0:i,_1:{ctor:"::",_0:u,_1:c}}):(t=t,n=r=o,g.cmp(mo(i),mo(u))<1?{ctor:"::",_0:i,_1:e}:{ctor:"::",_0:u,_1:e}))}})),u1=t(function(r,n,t,e,o){o=Ko(m(mt,function(t){return m(D,{ctor:"[]"},m(Nu,{ctor:"_Tuple2",_0:t,_1:r},n))},zo(o)));return d(c1,o,t,t,e)}),i1=t(function(t,r,n,e,o){for(;;){var c=t;if("[]"===c.ctor)return{ctor:"_Tuple2",_0:n,_1:e};var u=b(u1,c._0,r,n,e,o),i=u._0,u=u._1;t=c._1,r=r,n=i,e=u,o=o}}),_1=f(function(t,r,n,e){for(;;){var o=e;if("[]"===o.ctor)return n;o=b(i1,r,t,n,o._1,o._0);t=t,r=r,n=o._0,e=o._1}}),a1=s(function(t,r,n){for(;;){var e={ctor:"_Tuple2",_0:r,_1:n};if("_Tuple2"!==e.ctor||"::"!==e._0.ctor||"::"!==e._1.ctor)return t;var o=wu(m(ft,function(t){return{ctor:"_Tuple2",_0:t,_1:e._1._0}},e._0._0));t=m(xu,t,o),r=e._0._1,n=e._1._1}}),f1=l(function(t,e){var r=m(H,l(function(t,r){r=m(D,"NO_STATES_IN_LIST",_t(r)),r=m(D,-1,m(ul,r,e.states)),t=m(D,"NO_STATES_IN_LIST",_t(t)),t=m(D,-1,m(ul,t,e.states));return m(L,t,r)}),m(ft,function(t){return m(H,l(function(t,r){r=m(D,-1,m(ul,r,e.states)),t=m(D,-1,m(ul,t,e.states));return m(L,t,r)}),t)},m(ft,zo,t))),n=m(ft,function(t){return m(D,"NO_STATES_IN_LIST",_t(t))},r),o=m(ft,dr("_"),r),c=wu(m(Es,o,n)),t=m(lt,function(t){t=m(Nu,t,c);return"Just"===t.ctor&&m(ct,t._0,e.acceptStates)},o),u=v(a1,Au,r,o),n=m(D,"NO_START_STATE",m(Nu,e.startState,u)),r=m(ft,function(t){var r=m(D,"NO_OLD_STATE_HEAD",m(Nu,t,c)),n=m(D,Au,m(Nu,r,e.delta)),r=m(ft,function(t){var r=m(D,"NO_SYMBOL",m(Nu,t,n));return{ctor:"_Tuple2",_0:t,_1:m(D,"NO_OLD_STATE",m(Nu,r,u))}},e.inputAlphabet);return{ctor:"_Tuple2",_0:t,_1:wu(r)}},o),r=wu(r);return b(Jl,o,e.inputAlphabet,n,t,r)}),l1=l(function(t,r){for(;;){var n=t;if("[]"===n.ctor)return r;var e=n._0._0,o=v(Bu,{ctor:"_Tuple2",_0:n._0._2,_1:n._0._1},function(t){if("Nothing"===t.ctor)return F({ctor:"::",_0:e,_1:{ctor:"[]"}});t=t._0;return m(ct,e,t)?F(t):F({ctor:"::",_0:e,_1:t})},r);t=n._1,r=o}}),s1=function(t){t=ku(t.delta),t=m(mt,function(t){var r=t;return m(ft,function(t){return{ctor:"_Tuple3",_0:r._0,_1:t._0,_2:t._1}},ku(r._1))},t);return m(l1,t,Au)},d1=l(function(r,t){var n=m(lt,function(t){return!m(ct,t,r)},t.acceptStates),e=m(lt,function(t){return!m(ct,t,r)},t.states),o=Ko(e),c=wu(m(lt,function(t){return m(Uo,t._0,o)},ku(t.delta)));return b(Jl,e,t.inputAlphabet,t.startState,n,c)}),p1=f(function(r,t,n,e){for(;;){var o=n;if("[]"===o.ctor)return e;var c=m(Qo,function(t){return m(D,"",m(r,o._0,t))},t),u=m($o,e,c),i=r,_=t,c=o._1;r=i,t=_,n=c,e=u}}),h1=f(function(t,r,n,e){for(;;){if(Wo(e))return n;var o=d(p1,t,r,zo(e),Go),o=m(Yo,o,n);t=t,r=r,n=m($o,n,o),e=o}}),g1=function(t){var r=Ko(t.inputAlphabet),n=t1(t);return d(h1,n,r,Ho(t.startState),Ho(t.startState))},m1=function(t){var r=g1(t),n=m(lt,function(t){return!m(Uo,t,r)},t.states);return m(d1,n,t)},v1="// DFA recognizing { x in {0,1}* | x does not end in 000 }\n\nstates = {q, // last bit was a 1 or non-existent\n q0, // last two bits were 10\n q00, // last three bits were 100\n q000} // last three bits were 000\n\ninput_alphabet = {0,1}\n\n// no last bit when we start\nstart_state = q\n\n// accept if last three bits were not 000\naccept_states = {q,q0,q00}\n\ndelta =\n // if we see a 1, reset\n q,1 -> q;\n q0,1 -> q;\n q00,1 -> q;\n q000,1 -> q;\n\n // if we see a 0, count one more 0 than before\n q,0 -> q0;\n q0,0 -> q00;\n q00,0 -> q000;\n\n // until we get to three\n q000,0 -> q000;\n",b1=(g.chr("S"),g.chr("S"),g.chr("["),g.chr("]"),m(Wl,g.chr("S"),"[S]"),m(Wl,g.chr("S"),"SS"),m(Wl,g.chr("S"),""),"Ok"===(qo=Z0(v1)).ctor?qo._0:g.crashCase("Defaults",{start:{line:89,column:5},end:{line:94,column:28}},qo)(qo._0),Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"margin",_1:"2pt"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"padding",_1:"2pt"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"font-weight",_1:"bold"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"font-size",_1:"20px"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"background-color",_1:"lightgray"},_1:{ctor:"[]"}}}}}})),T1=l(function(t,r){for(;;){var n=t;if("[]"===n.ctor)return r;var e=n._0._0._0,o=n._0._0._1,c=m(D,Au,m(Nu,e,r)),u=m(D,Go,m(Nu,o,c)),u=m($o,u,n._0._1),c=v(Ru,o,u,c),c=v(Ru,e,c,r);t=n._1,r=c}}),y1=l(function(t,r){return m(uf,function(n){return m(uf,function(t){var r=vr(t);return"Nothing"===r.ctor?pf({ctor:"_Tuple2",_0:n,_1:Fl}):""===r._0._1?pf({ctor:"_Tuple2",_0:n,_1:r._0._0}):bf(m(N["++"],"second input to NFA transition should be single character or empty string but is ",t))},m(ff["|."],m(mf,"the transition input symbol",ll(r)),l0))},m(ff["|."],m(ff["|."],m(ff["|."],m(mf,"the transition input state",m(n0,t,"state set")),l0),xf(",")),l0))}),w1=l(function(n,t){return m(uf,function(t){var r=t;return m(uf,function(t){return pf({ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:r._0,_1:r._1},_1:t})},(t=n,m(uf,function(t){return pf(Ko(t))},m(mf,"the transition output state(s)",Ff({ctor:"::",_0:m(ff["|."],m(ff["|."],m(s0,t,"state set"),l0),xf(f0)),_1:{ctor:"::",_0:m(ff["|."],m(ff["|."],m(e0,t,"state set"),l0),xf(f0)),_1:{ctor:"::",_0:bf("If you are trying to specify a nondeterministic transition, be sure to use curly brace set notation. For example, write q1,0 -> {q2,q3,q4}; instead of q1,0 -> q2,q3,q4;"),_1:{ctor:"[]"}}}})))))},m(ff["|."],m(ff["|."],m(ff["|."],m(mf,"the transition inputs",m(y1,n,t)),l0),xf("->")),l0))}),k1=s(function(r,n,e){return Ff({ctor:"::",_0:m(uf,function(t){return m(uf,function(t){t={ctor:"::",_0:{ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:t._0._0,_1:t._0._1},_1:t._1},_1:e};return v(k1,r,n,t)},m(ff["|."],m(mf,"the transition",m(w1,r,n)),l0))},rl),_1:{ctor:"::",_0:pf(dt(e)),_1:{ctor:"[]"}}})}),S1=s(function(t,r,n){var r=m(Cs,t,{ctor:"::",_0:Fl,_1:r}),e=m(ft,function(t){return{ctor:"_Tuple2",_0:t._0._0,_1:t._0._1}},n);return m(lt,function(t){return!m(ct,t,e)},r)}),x1=l(function(n,e){return m(uf,function(t){var r=m(ft,function(t){return{ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:t._0,_1:t._1},_1:Go}},v(S1,n,e,t));return pf(m(N["++"],t,r))},m(ff["|="],pf(R),v(k1,n,e,{ctor:"[]"})))}),B1=l(function(t,r){return m(df,pl,m(x1,t,r))}),R1=m(uf,function(t){var r=t._0,n=t._1;return m(uf,function(t){return pf(b(zl,r,n,t._0,t._1,t._2))},m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(s(function(t,r,n){return{ctor:"_Tuple3",_0:t,_1:r,_2:n}})),lf("start_state")),l0),xf(g0)),l0),m(mf,"the start state",m(n0,r,"state set"))),l0),lf("accept_states")),l0),xf(g0)),l0),m(mf,"the set of accept states",m(s0,r,"state set"))),l0),lf("delta")),l0),xf(g0)),l0),m(mf,"the transition function delta",m(B1,r,n))),l0),Rf))},m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}})),l0),lf("states")),l0),xf(g0)),l0),m(mf,"the set of states",Po)),l0),lf("input_alphabet")),l0),xf(g0)),l0),m(mf,"the input alphabet",Do)),l0)),N1=function(t){return m(a0,R1,t)},A1=function(t){return N1(t)},q1=s(function(t,r,n){var e={ctor:"::",_0:Fl,_1:t.inputAlphabet},o="Epsilon"===n.ctor?Fl:n._0,n=v(Ds,r,o,t.delta);return"Just"===n.ctor?F(n._0):m(ct,r,t.states)&&m(ct,o,e)?F(Go):P}),C1=s(function(t,r,n){for(;;){var e=r;if("[]"===e.ctor)return Qt(n);var o=e._0,c=m(t,o,Vl);if("Nothing"===c.ctor)return Vt(m(N["++"],"epsilon transition not defined for transition function delta on state ",o));o=m(Vo,o,n),c=m(Yo,c._0,n);t=t,r=m(N["++"],zo(c),e._1),n=o}}),M1=l(function(t,r){return v(C1,t,zo(r),Go)}),E1=s(function(n,t,e){t=m(ft,function(t){var r=m(n,t,Kl(e));return"Nothing"===r.ctor?Vt(m(N["++"],"transition function delta is not defined on state '",m(N["++"],t,m(N["++"],"' or input symbol '",m(N["++"],Tr(e),"'"))))):Qt(r._0)},zo(t));return m($t,m(nt,$o,Go),ms(t))}),L1=s(function(n,e,o){return m(Kt,function(t){var r=vr(o);return"Nothing"===r.ctor?Qt({ctor:"::",_0:t,_1:{ctor:"[]"}}):m($t,function(t){return{ctor:"::",_0:e,_1:t}},m(Kt,function(t){return v(L1,n,t,r._0._1)},m(Kt,function(t){return m(M1,n,t)},v(E1,n,t,r._0._0))))},m(M1,n,e))}),O1=l(function(r,n){return m(Kt,function(t){return m(Kt,function(t){return v(L1,q1(r),t,n)},m(M1,q1(r),Ho(r.startState)))},m(ys,r.inputAlphabet,n))}),D1=s(function(t,r,n){return m(Kt,function(t){t=dt(t);return"[]"===t.ctor?Vt("This should be unreachable since statesVisitedFrom returns a positive-length list"):Qt(t._0)},v(L1,t,r,n))}),P1=(l(function(r,n){return m(Kt,function(t){return m($t,function(t){return!Wo(m(Xo,t,Ko(r.acceptStates)))},v(D1,q1(r),Ho(r.startState),n))},m(ys,r.inputAlphabet,n))}),l(function(r,t){return d(la,ha,da(r.variable),function(t){return m(N["++"],"(",m(N["++"],r.expression,")"))},t)})),I1=l(function(t,r){for(;;){var n=t;if("[]"===n.ctor)return r;m(fn,"substitutionNonRaw",r);var e=m(P1,n._0,r);m(fn,"newSubstitutionNonRaw",e);t=n._1,r=e}}),F1=l(function(t,r){for(;;){var n=r;if("::"!==n.ctor)return Vt("no substitution is possible since there are no subexpressions; this shouldn't happen because the list of subexpressions should never be below size 1");if("::"!==n._1.ctor)return Qt(m(I1,t,n._0));o=(e=n._0,o=void 0,"[]"===(o=m(ft,ur,m(pr,"=",e))).ctor?Vt("cannot happen because String.split returns a positive-length List"):"[]"===o._1.ctor?Vt(m(N["++"],'there is no substitution definition here since the symbol "=" does not appear in ',e)):"[]"===o._1._1.ctor?Qt({variable:o._0,expression:o._1._0}):Vt(m(N["++"],'should be exactly one instance of "=" in subexpression definition, but I found several:\n',e)));if("Err"===o.ctor)return Vt(o._0);e=o._0,o=m(I1,t,e.expression);t={ctor:"::",_0:g.update(e,{expression:o}),_1:t},r={ctor:"::",_0:n._1._0,_1:n._1._1}}var e,o}),J1=function(t){return m(F1,{ctor:"[]"},t)},z1=function(t){return Vt(m(N["++"],'regex "',m(N["++"],t,m(N["++"],'" contains illegal symbols;\n',"must contain only letters, numbers, and these symbols: @ . ( ) * + |"))))},U1=function(t){var r=da("^(\\.|@|[a-z]|[A-Z]|[0-9]|\\(|\\)|\\+|\\*|\\|)*$");return m(sa,r,t)},W1=function(r){m(fn,"rxText",r);var t=d(la,ha,da("\\s+"),function(t){return""},r);if(U1(t)){t=d(la,ha,da("\\."),function(t){return"\\."},t),t=m(N["++"],"^(",m(N["++"],t,")$")),t=Il(t);if("Ok"===t.ctor)return Qt({originalText:r,rx:t._0});t=d(la,ha,da("/\\^.*\\$/"),function(t){return m(N["++"],"\n ",m(N["++"],r,"\n"))},t._0);return Vt(t)}return z1(r)},j1=function(t){t=ls(as(t)),t=m(ft,ur,m(pr,";",t)),m(fn,"subexpressions",t),m(fn,"subexpressions after substitutions",J1(t));return m(Kt,W1,J1(t))},G1=l(function(t,r){return m(Dl,t.rx,r)}),H1=(l(function(t,r){return{variable:t,expression:r}}),l(function(t,r){return g.update(r,{cur:t})})),V1=g.chr("?"),K1=g.chr("_"),Q1=v(Gl,{ctor:"[]"},K1,{ctor:"[]"}),$1=s(function(t,r,n){var e=vr(n);if("Nothing"===e.ctor)return"";var o=e._0._1,c=e._0._0;if(g.eq(c,V1)){n=Qe(t),e=m(N["%"],r,n),e=m(D,g.chr("?"),m(Ye,e,t));return m(br,e,v($1,t,r/n|0,o))}return m(br,c,v($1,t,r,o))}),X1=s(function(t,r,n){t=to(t);return v($1,t,r,n)}),Y1=f(function(t,r,n,e){for(;;){var o=v(X1,t,e,r);if(!m(Uo,o,n))return o;t=t,r=r,n=n,e=e+1}}),Z1=s(function(t,r,n){var e,o="Nothing"===(e=_t(t)).ctor?g.crashCase("TMParser",{start:{line:527,column:13},end:{line:532,column:39}},e)("unreachable"):Tr(e._0);d(la,ha,da(pa(Tr(V1))),function(t){return o},r);return d(Y1,t,r,n,0)}),td=l(function(t,r){t=et(t),r=et(m(er,Tr(V1),r));return Math.pow(t,r)}),rd=s(function(t,r,n){var e={ctor:"_Tuple2",_0:vr(r),_1:vr(n)};t:do{if("_Tuple2"!==e.ctor)break t;if("Nothing"===e._0.ctor){if("Nothing"===e._1.ctor)return{ctor:"::",_0:"",_1:{ctor:"[]"}};break t}if("_Tuple2"!==e._0._0.ctor||"Just"!==e._1.ctor||"_Tuple2"!==e._1._0.ctor)break t;var o=e._1._0._0,c=e._0._0._0,u=v(rd,t,e._0._0._1,e._1._0._1);if(g.eq({ctor:"_Tuple2",_0:c,_1:o},{ctor:"_Tuple2",_0:V1,_1:V1}))return m(ft,S(br),m(Cs,t,u));if(g.eq(c,V1)||g.eq(o,V1)){var i=g.eq(c,V1)?g.eq(o,V1)?g.crash("TMParser",{start:{line:438,column:33},end:{line:438,column:44}})("This should be unreachable."):o:c;return m(ft,br(i),u)}return g.eq(c,o)?m(ft,br(c),u):{ctor:"[]"}}while(0);return g.crashCase("TMParser",{start:{line:411,column:5},end:{line:444,column:54}},e)("This should be unreachable.")}),nd=s(function(t,r,n){var e=m(Es,Zt(r),Zt(n));return m(Z,function(t){var r=t._1,t=t._0;return!g.eq(t,r)&&!g.eq(t,V1)&&!g.eq(r,V1)},e)?{ctor:"[]"}:v(rd,t,r,n)}),ed=l(function(e,o){return m(uf,function(t){var r=Ko(e),n=Ko(Zt(t)),n=m(Yo,n,r);return Wo(n)?g.eq(o,gr(t))?pf(t):bf(m(N["++"],"there are ",m(N["++"],A(gr(t)),m(N["++"],' symbols in "',m(N["++"],t,m(N["++"],'" but there are ',m(N["++"],A(o)," in this TM"))))))):bf(m(N["++"],"invalid symbols ",m(N["++"],il(n),m(N["++"],' in "',m(N["++"],t,m(N["++"],'"; should only be symbols from the set ',il(r)))))))},m(Lf,Uf,function(t){return!m(ct,t,{ctor:"::",_0:g.chr(" "),_1:{ctor:"::",_0:g.chr("\t"),_1:{ctor:"::",_0:g.chr("\n"),_1:{ctor:"::",_0:g.chr(","),_1:{ctor:"::",_0:g.chr(";"),_1:{ctor:"[]"}}}}}})}))}),od=s(function(o,c,u){return m(uf,function(t){var r=Ko(o),n=Ko(Zt(t)),e=m(Yo,n,r);if(Wo(e)){if(g.eq(c,gr(t))){n=v(Ms,m(Rt,0,c-1),Zt(u),Zt(t)),n=m(lt,function(t){return g.eq(t._2,V1)&&!g.eq(t._1,V1)},n);return"::"===n.ctor?bf(m(N["++"],"this transition has a wildcard symbol ",m(N["++"],Tr(V1),m(N["++"]," on output tape ",m(N["++"],A(n._0._0),m(N["++"]," but a non-wildcard symbol ",m(N["++"],Tr(n._0._1)," specified for input on the same tape. The output can only be a wildcard if the input also is."))))))):pf(t)}return bf(m(N["++"],"there are ",m(N["++"],A(gr(t)),m(N["++"]," symbols in input '",m(N["++"],t,m(N["++"],"' but there are ",m(N["++"],A(c)," in this TM")))))))}return bf(m(N["++"],"invalid symbols ",m(N["++"],il(e),m(N["++"]," in string '",m(N["++"],t,m(N["++"],"'; should only be symbols from the set ",il(r)))))))},m(Lf,Uf,function(t){return!m(ct,t,{ctor:"::",_0:g.chr(" "),_1:{ctor:"::",_0:g.chr("\t"),_1:{ctor:"::",_0:g.chr("\n"),_1:{ctor:"::",_0:g.chr(","),_1:{ctor:"::",_0:g.chr(";"),_1:{ctor:"[]"}}}}}})}))}),cd=t(function(t,r,n,e,o){return m(uf,function(t){var r;return pf({ctor:"_Tuple3",_0:t._0,_1:t._1,_2:(r=t._2,m(ft,function(t){t=Zl(t);return"Just"===t.ctor?t._0:g.crashCase("TMParser",{start:{line:373,column:17},end:{line:378,column:231}},t)(m(N["++"],"This should be unreachable since we already verified that movesStr '",m(N["++"],r,"' only contains characters 'L', 'R', and 'S'. There is a bug in the software. Please contact the author.")))},Zt(r)))})},m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],pf(s(function(t,r,n){return{ctor:"_Tuple3",_0:t,_1:r,_2:n}})),m(mf,"the transition output state",m(n0,t,"state set"))),l0),xf(",")),l0),m(mf,"the transition output symbol(s)",v(od,r,n,o))),l0),xf(",")),l0),m(mf,"the transition moves",m(ed,{ctor:"::",_0:g.chr("L"),_1:{ctor:"::",_0:g.chr("R"),_1:{ctor:"::",_0:g.chr("S"),_1:{ctor:"[]"}}}},n))))}),ud=f(function(t,r,e,o){return m(uf,function(n){return m(uf,function(t){if(g.eq(e,gr(t))){var r=m(Nu,{ctor:"_Tuple2",_0:n,_1:t},o);return"Nothing"===r.ctor?pf({ctor:"_Tuple2",_0:n,_1:t}):bf(m(N["++"],"duplicate transition; delta has an existing transition ",m(N["++"],v(ss,n,t,!1),m(N["++"]," -> ",m(N["++"],m(N["++"],r._0._0._0,m(N["++"],",",m(N["++"],r._0._0._1,m(N["++"],",",Yt(m(ft,cl,r._0._0._2)))))),m(N["++"]," at line ",m(o0,r._0._1,r._0._2)))))))}return bf(m(N["++"],"there are ",m(N["++"],A(gr(t)),m(N["++"],' symbols in input "',m(N["++"],t,m(N["++"],'", but there are ',m(N["++"],A(e)," tapes in this TM")))))))},m(ff["|."],m(mf,"the transition input symbol(s)",ll(r)),l0))},m(ff["|."],m(ff["|."],m(ff["|."],m(mf,"the transition input state",m(n0,t,"set of non-halting states")),l0),xf(",")),l0))}),id=t(function(e,t,o,c,r){return m(uf,function(t){var r=t._1,n=t._0;return m(mf,"the transition output",m(uf,function(t){return pf({ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:n,_1:r},_1:t})},m(ff["|."],m(ff["|."],b(cd,e,o,c,n,r),l0),xf(f0))))},m(ff["|."],m(ff["|."],m(ff["|."],m(mf,"the transition inputs",d(ud,t,o,c,r)),l0),xf("->")),l0))}),_d=l(function(r,n){return m(mf,"the state",m(uf,function(t){return m(ct,t,r)&&!g.eq(t,n)?pf(t):m(ct,t,r)?bf("accept and reject states must be distinct"):bf(m(N["++"],"state ",m(N["++"],t,m(N["++"]," is not in the state set ",gs(r)))))},r0))}),ad=f(function(t,r,n,e){o=v(Y,l(function(t,r){return g.eq(t,r)?t:g.eq(t,V1)&&!g.eq(r,V1)?r:!g.eq(t,V1)&&g.eq(r,V1)?t:Fl}),Zt(r),Zt(n)),o=m(ct,Fl,o)?P:F(Yt(o)),t=m(Is,V1,t);if("Nothing"===o.ctor)return Tl(Go);var o=o._0;if(g.cmp(m(td,t,o)-mo(e),10)<1){n=Ko(v(nd,t,r,n)),n=m(Yo,n,e);return Tl(n)}return{ctor:"Example",_0:v(Z1,t,o,e)}}),fd=l(function(i,_){var t=m(Bs,l(function(t,r){return g.eq(t._0,r._0)}),Su(_)),a=wu(m(ft,function(t){return{ctor:"_Tuple2",_0:"::"===(r=t).ctor&&"_Tuple2"===r._0.ctor?r._0._0:g.crashCase("TMParser",{start:{line:612,column:13},end:{line:617,column:114}},r)("This should be unreachable since Util.groupBy creates a list of nonempty lists."),_1:m(ln,Ko,m(vt,or(Tr(V1)),(t=t,v(rt,l(function(t,r){return{ctor:"::",_0:t,_1:r}}),{ctor:"[]"},m(ft,sn,t)))))};var r},t)),t=Su(a);return m(As,function(t){return!yr(t)},m(ft,function(t){var n=m(Nu,t,a);if("Nothing"===n.ctor)return g.crashCase("TMParser",{start:{line:646,column:13},end:{line:694,column:413}},n)("This should be unreachable since we should only call errMsgOnState with a valid state.");var r=m(ft,function(t){var r=t._1,t=t._0;return{ctor:"_Tuple3",_0:t,_1:r,_2:d(ad,i,t,r,n._0._1)}},qs(n._0._0)),e=m(As,function(t){t=t._2;return"SetOfStrings"!==t.ctor||!Wo(t._0)},r);if("Nothing"===e.ctor)return"";var o,c=e._0._1,u=e._0._0,r="Example"===(o=e._0._2).ctor?m(N["++"],"Those wildcard-containing input symbols overlap on some input strings that are not defined elsewhere in delta. There are too many to list, but here is an example of a string that matches both wildcard transitions but is not defined explicitly elsewhere in the definition of delta: ",m(N["++"],o._0,".")):m(N["++"],"Those wildcard-containing input symbols overlap on the following input strings that are not defined elsewhere in delta: ",m(N["++"],(o=o._0,gs(zo(o))),".")),o="_Tuple2"===(e={ctor:"_Tuple2",_0:m(Nu,{ctor:"_Tuple2",_0:t,_1:u},_),_1:m(Nu,{ctor:"_Tuple2",_0:t,_1:c},_)}).ctor&&"Just"===e._0.ctor&&"_Tuple3"===e._0._0.ctor&&"Just"===e._1.ctor&&"_Tuple3"===e._1._0.ctor?{ctor:"_Tuple2",_0:m(o0,e._0._0._1,e._0._0._2),_1:m(o0,e._1._0._1,e._1._0._2)}:g.crashCase("TMParser",{start:{line:679,column:41},end:{line:684,column:90}},e)("This should be unreachable."),e=o._0,o=o._1;return m(N["++"],"There are two transitions with input state ",m(N["++"],t,m(N["++"],", taking as input wildcard-containing input symbols ",m(N["++"],u,m(N["++"]," and ",m(N["++"],c,m(N["++"],". They are defined on lines ",m(N["++"],e,m(N["++"]," and ",m(N["++"],o,m(N["++"],". ",m(N["++"],r,m(N["++"]," This is ambiguous; please define delta explicitly for input state ",m(N["++"],t," on all input symbols in this set."))))))))))))))},t))}),ld=u(function(c,u,i,_,a,f){return Ff({ctor:"::",_0:m(uf,function(t){var o=t;return m(uf,function(t){var r=t._1,n=t._0._1,e=t._0._0,t={ctor:"::",_0:{ctor:"_Tuple2",_0:{ctor:"_Tuple2",_0:e,_1:n},_1:r},_1:f},r=v(Ru,{ctor:"_Tuple2",_0:e,_1:n},{ctor:"_Tuple3",_0:r,_1:o._0,_2:o._1},a);return p(ld,c,u,i,_,r,t)},m(ff["|."],m(mf,"the transition",b(id,c,u,i,_,a)),l0))},rl),_1:{ctor:"::",_0:"Nothing"===(t=m(fd,i,a)).ctor?pf(dt(f)):bf(t._0),_1:{ctor:"[]"}}});var t}),sd=f(function(t,r,n,e){return m(uf,function(t){return pf(t)},m(ff["|="],pf(R),p(ld,t,r,n,e,Au,{ctor:"[]"})))}),dd=f(function(t,r,n,e){return m(df,_l,d(sd,t,r,n,e))}),pd=f(function(t,r,n,e){return m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(R),lf("delta")),l0),xf(g0)),l0),m(mf,"the transition function delta",d(dd,t,r,m(N["++"],n,{ctor:"::",_0:V1,_1:{ctor:"[]"}}),e))),l0),Rf)}),hd=m(uf,function(t){var i=t._0,_=t._1;return m(uf,function(u){return m(uf,function(t){var o=t,c=o._1;return m(uf,function(t){var r=t._0,n=t._1,t=m(lt,function(t){return!g.eq(t,c)&&!g.eq(t,r)},i),e=m(N["++"],_,u);return m(uf,function(t){return pf(a(jl,i,_,e,o._0,c,r,n,t))},d(pd,i,t,e,n))},m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}})),lf("reject_state")),l0),xf(g0)),l0),m(mf,"the reject state",m(_d,i,c))),l0),lf("num_tapes")),l0),xf(g0)),l0),m(mf,"the number of tapes",Pf)),l0))},m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}})),lf("start_state")),l0),xf(g0)),l0),m(mf,"the start state",m(n0,i,"state set"))),l0),lf("accept_state")),l0),xf(g0)),l0),m(mf,"the accept state",m(n0,i,"state set"))),l0))},m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(R),lf("tape_alphabet_extra")),l0),xf(g0)),l0),m(mf,"the extra tape alphabet symbols",m(h0,Ko(m(N["++"],_,{ctor:"::",_0:V1,_1:{ctor:"[]"}})),Ho(K1)))),l0))},m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|="],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],m(ff["|."],pf(l(function(t,r){return{ctor:"_Tuple2",_0:t,_1:r}})),l0),lf("states")),l0),xf(g0)),l0),m(mf,"the set of states",Po)),l0),lf("input_alphabet")),l0),xf(g0)),l0),m(mf,"the input alphabet",m(h0,Ko({ctor:"::",_0:K1,_1:{ctor:"::",_0:V1,_1:{ctor:"[]"}}}),Go))),l0)),gd=function(t){return m(a0,hd,t)},md=function(t){return gd(t)},vd=l(function(t,r){r=Zt(r),t=Zt(t);return Yt(v(Y,l(function(t,r){return g.eq(r,V1)?t:r}),t,r))}),bd=l(function(t,r){return m(tt,function(t){var r=t,t=r._0;return g.eq(t,V1)||g.eq(t,r._1)},m(Ls,t,r))}),Td=s(function(t,r,n){return m(I,function(r){var t=m(Nu,n,r);if("Just"===t.ctor)return F(t._0);t=m(lt,or(Tr(V1)),Su(r)),t=m(As,function(t){return m(bd,t,n)},t);return m(I,function(t){return m(J,function(t){return{ctor:"_Tuple3",_0:t._0,_1:m(vd,n,t._1),_2:t._2}},m(Nu,t,r))},t)},m(Nu,r,t.delta))}),yd=l(function(t,r){var r="Nothing"===(n=vr(r)).ctor?Q1:v(Gl,{ctor:"[]"},n._0._0,m(N["++"],Zt(n._0._1),{ctor:"::",_0:K1,_1:{ctor:"[]"}})),n=m(xt,t.numTapes-1,Q1);return m(Hl,t.startState,{ctor:"::",_0:r,_1:n})}),wd=l(function(t,r){return g.eq(r,t.acceptState)||g.eq(r,t.rejectState)}),kd=function(t){var r=m(N["++"],Tr(t.cur),Yt(t.right)),t=m(nr,Tr(K1),r),t=_t(t);return"Nothing"===t.ctor?r:m(fr,t._0,r)},Sd=function(t){return kd(ws(t.tapes))},xd=f(function(t,r,n,e){var o={ctor:"_Tuple2",_0:r,_1:n};switch(o._0.ctor){case"Stay":switch(o._1.ctor){case"Same":return m(H1,t,e);case"Grow":return m(H1,t,hl(e));default:return m(H1,t,bl(e))}case"Left":switch(o._1.ctor){case"Same":return m(H1,t,gl(e));case"Grow":return m(H1,t,gl(hl(e)));default:return m(H1,t,gl(bl(e)))}default:switch(o._1.ctor){case"Same":return m(H1,t,ml(e));case"Grow":return m(H1,t,hl(ml(e)));default:return g.crashCase("TM",{start:{line:198,column:5},end:{line:231,column:106}},o)("unreachable; the TM should never attempt to shrink the tape while growing right")}}}),Bd=l(function(t,r){return m(Hl,t.prevState,b($,xd,Zt(t.prevSymbols),t.moves,t.tapeChanges,r.tapes))}),Rd=f(function(t,r,n,e){var o=m(H1,t,e),c={ctor:"_Tuple2",_0:r,_1:n};switch(c._0.ctor){case"Stay":switch(c._1.ctor){case"Same":return o;case"Grow":return bl(o);default:return hl(o)}case"Left":switch(c._1.ctor){case"Same":return ml(o);case"Grow":return ml(bl(o));default:return hl(ml(o))}default:switch(c._1.ctor){case"Same":return gl(o);case"Grow":return gl(bl(o));default:return g.crashCase("TM",{start:{line:144,column:9},end:{line:177,column:110}},c)("unreachable; the TM should never attempt to shrink the tape while growing right")}}}),Nd=l(function(t,r){return m(Hl,t.nextState,b($,Rd,Zt(t.nextSymbols),t.moves,t.tapeChanges,r.tapes))}),Ad=s(function(t,r,n){return!vl(n)||!g.eq(r,Xl)&&g.eq(t,K1)?g.eq(r,Yl)&&vl(n)&&g.eq(t,K1)&&function(t){var r=dt(t.right);if("[]"!==r.ctor)return"[]"===r._1.ctor?g.eq(t.cur,K1):g.eq(r._1._0,K1);t=t.left;return"[]"!==t.ctor&&g.eq(t._0,K1)}(n)||!g.eq(r,Xl)&&(g.eq(et(n.right),1)&&g.eq(t,K1)&&("[]"===(n=dt((t=n).right)).ctor?g.eq(t.cur,K1):g.eq(n._0,K1)))?rs:ts:ns}),qd=s(function(t,r,n){if(!m(wd,t,r)&&m(ct,r,t.states)&&m(Ts,t.tapeAlphabet,n)){r=v(Td,t,r,n);return"Just"===r.ctor?F(r._0):F({ctor:"_Tuple3",_0:t.rejectState,_1:n,_2:m(xt,t.numTapes,$l)})}return P}),Cd=1e4,Md=u(function(t,r,n,e,o,c){return{prevState:t,nextState:r,prevSymbols:n,nextSymbols:e,moves:o,tapeChanges:c}}),Ed=l(function(t,r){var n=yl(r),e=v(qd,t,r.state,n);if("Nothing"===e.ctor)return Vt(m(N["++"],"TM transition function delta not defined on state '",m(N["++"],r.state,m(N["++"],"' and symbols '",m(N["++"],n,"'")))));var o=e._0._1,c=e._0._2,u=d(X,Ad,Zt(o),c,r.tapes),t=l(function(t,r){return g.eq(t,Yl)&&ut(r.left)?$l:t}),c=v(Y,t,c,r.tapes);return Qt(p(Md,r.state,e._0._0,n,o,c,u))}),Ld=l(function(t,r){return m($t,function(t){return{ctor:"_Tuple2",_0:m(Nd,t,r),_1:t}},m(Ed,t,r))}),Od=(l(function(t,r){return m($t,dn,m(Ld,t,r))}),f(function(t,r,n,e){for(;;){if(g.cmp(r,0)<1||m(wd,t,n.state))return Qt({ctor:"_Tuple2",_0:dt(e),_1:n});var o=m(Ld,t,n);if("Err"===o.ctor)return Vt(o._0);t=t,r=r-1,n=o._0._0,e={ctor:"::",_0:o._0._1,_1:e}}})),Dd=l(function(r,n){var t,t="::"===(t=n.tapes).ctor?kd(t._0):g.crashCase("TM",{start:{line:254,column:13},end:{line:259,column:88}},t)("unreachable because there is always at least one tape");return m(Kt,function(t){return d(Od,r,Cd,n,{ctor:"[]"})},m(ys,r.inputAlphabet,t))}),Pd=(l(function(t,r){return m($t,m(pt,Nd,r),m($t,dn,m(Dd,t,r)))}),l(function(t,r){return m($t,function(t){return t._1},m(Dd,t,r))})),Id=l(function(t,r){r=m(yd,t,r);return m(Pd,t,r)}),Fd=l(function(r,n){return m(Kt,function(t){return m(Kt,function(t){return m(wd,r,t.state)?Qt({ctor:"_Tuple2",_0:g.eq(t.state,r.acceptState),_1:Sd(t)}):Vt(m(N["++"],"TM did not halt after ",m(N["++"],A(Cd),m(N["++"]," steps on input ",n))))},m(Id,r,n))},m(ys,r.inputAlphabet,n))}),su=(l(function(t,r){return m($t,dn,m(Fd,t,r))}),l(function(t,r){return m($t,sn,m(Fd,t,r))}),m(su,V_(.5),Y_({orientation:Q_,splitterPosition:{ctor:"_Tuple2",_0:V_(.5),_1:m(qu,V_(0),V_(1))},dragState:X_(P)}))),Jd=function(t){switch(t.ctor){case"DFAType":return"DFA";case"NFAType":return"NFA";case"CFGType":return"CFG";case"RegexType":return"Regex";default:return"TM"}},zd=function(t){switch(t.ctor){case"DFAType":return"dfa";case"NFAType":return"nfa";case"CFGType":return"cfg";case"RegexType":return"regex";default:return"tm"}},Ud=function(t){return"[]"===t.ctor?{ctor:"[]"}:{ctor:"::",_0:g.chr(" "),_1:{ctor:"::",_0:t._0,_1:Ud(t._1)}}},Wd=l(function(t,r){if("[]"===t.ctor)return{ctor:"[]"};var n=t._1,t=t._0;return r?{ctor:"::",_0:zt(160),_1:{ctor:"::",_0:t,_1:Ud(n)}}:{ctor:"::",_0:t,_1:Ud(n)}}),jd=l(function(t,r){var n=Su(r.delta),e=m(lt,function(t){return!m(ct,t,n)},r.states),i=f(function(t,r,n,e){e=m(N["++"],r,m(N["++"],",",m(N["++"],n,m(N["++"],",",m(dr,"",m(ft,Tr,m(ft,cl,e)))))));return m(N["++"],t,m(N["++"],"",m(N["++"],Us,m(N["++"],"",e))))}),_=u(function(t,r,n,e,o,c){var u=c,c=u._0,e=g.eq(n,r.curCfg.state)&&(g.eq(c,e)||!o&&m(bd,c,e))?"current ":"";return m(wi,{ctor:"::",_0:Oi(m(N["++"],e,"transition_entry")),_1:{ctor:"::",_0:m(qi,"state",n),_1:{ctor:"::",_0:m(qi,"is_state_cell","false"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li(d(i,c,u._1._0,u._1._1,u._1._2)),_1:{ctor:"[]"}})}),o=s(function(t,r,n){var e=g.eq(n,r.acceptState)?"transition_entry_accept":g.eq(n,r.rejectState)?"transition_entry_reject":"transition_entry",o=g.eq(n,t.curCfg.state)?"current ":"",c=m(wi,{ctor:"::",_0:m(qi,"is_state_cell","true"),_1:{ctor:"::",_0:Oi(m(N["++"],o,e)),_1:{ctor:"[]"}}},{ctor:"::",_0:li(n),_1:{ctor:"[]"}}),u=m(Nu,n,r.delta);if("Nothing"===u.ctor)return m(yi,{ctor:"::",_0:m(qi,"state",n),_1:{ctor:"[]"}},{ctor:"::",_0:c,_1:{ctor:"[]"}});o=m(J,Su,m(Nu,n,r.delta)),e=yl(t.curCfg),o="Nothing"!==o.ctor&&m(ct,e,o._0),u=ku(u._0);return m(yi,{ctor:"::",_0:m(qi,"state",n),_1:{ctor:"::",_0:Di(m(N["++"],"transition-row-",n)),_1:{ctor:"[]"}}},{ctor:"::",_0:c,_1:{ctor:"::",_0:m(wi,{ctor:"[]"},{ctor:"::",_0:m(Ti,{ctor:"[]"},{ctor:"::",_0:m(yi,{ctor:"[]"},m(ft,b(_,r,t,n,e,o),u)),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})}),c=m(yi,{ctor:"::",_0:Di("transition_table_head"),_1:{ctor:"[]"}},{ctor:"::",_0:m(ki,{ctor:"::",_0:Oi("transition_header_entry"),_1:{ctor:"[]"}},{ctor:"::",_0:li("state"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:m(ki,{ctor:"::",_0:Oi("transition_header_entry"),_1:{ctor:"::",_0:ei(100),_1:{ctor:"::",_0:oi("left"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li("transitions"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}});return m(Ti,{ctor:"::",_0:Di("transition_table"),_1:{ctor:"[]"}},{ctor:"::",_0:c,_1:m(ft,m(o,t,r),m(N["++"],n,e))})}),Gd=function(t){var r=t._0,n=t._1,e={ctor:"::",_0:m(qi,"data-toggle","tooltip"),_1:{ctor:"::",_0:Pi(m(N["++"],"TM tape ",A(n))),_1:{ctor:"[]"}}},t=l(function(t,r){return m(wi,{ctor:"::",_0:Oi(m(N["++"],"tape_cell",t)),_1:{ctor:"[]"}},{ctor:"::",_0:li(Tr(r)),_1:{ctor:"[]"}})});m(N["++"],"tape_",A(n));return m(yi,e,m(N["++"],dt(m(ft,t(""),r.left)),m(N["++"],{ctor:"::",_0:m(t," current",r.cur),_1:{ctor:"[]"}},m(ft,t(""),r.right))))},Hd=function(t){var r=yr(t.outSymbols)?Tr(Fl):t.outSymbols;return m(yi,{ctor:"[]"},{ctor:"::",_0:m(wi,{ctor:"[]"},{ctor:"::",_0:li(m(N["++"],Tr(t.inSymbol),m(N["++"]," ",m(N["++"],Us,m(N["++"]," ",r))))),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})},Vd=function(t){t=t.accepted;return"Just"===t.ctor?!0===t._0?m(di,{ctor:"::",_0:Di("accepted_display"),_1:{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"color",_1:"green"},_1:{ctor:"[]"}}),_1:{ctor:"[]"}}},{ctor:"::",_0:li("accepted"),_1:{ctor:"[]"}}):m(di,{ctor:"::",_0:Di("accepted_display"),_1:{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"color",_1:"red"},_1:{ctor:"[]"}}),_1:{ctor:"[]"}}},{ctor:"::",_0:li("rejected"),_1:{ctor:"[]"}}):li("")},Kd=function(t){var r=m(N["++"],".",zd(t.automatonType));return m(vi,{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"padding",_1:"5pt"},_1:{ctor:"[]"}}),_1:{ctor:"[]"}},{ctor:"::",_0:m(gi,{ctor:"::",_0:Ii("button"),_1:{ctor:"::",_0:Ui(m(N["++"],"data:text/plain;charset=utf-8,",ma(t.automatonText))),_1:{ctor:"::",_0:ji(m(N["++"],"automaton",r)),_1:{ctor:"[]"}}}},{ctor:"::",_0:m(Bi,{ctor:"[]"},{ctor:"::",_0:li("Save"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}})},Qd=!0,$d=function(t){return m(N["++"],A(t-100),"px")},Xd=l(function(t,r){var n=t;switch(n.ctor){case"N":return m(O1,n._0,r);case"D":return m($t,ft(Ho),m(e1,n._0,r));default:return Vt("no finite automaton currently loaded")}}),Yd=pn.outgoingPort("fileSelected",function(t){return t}),Zd=pn.incomingPort("fileContentRead",m(xo,function(r){return m(xo,function(t){return Ro({contents:r,filename:t})},m(Oo,"filename",Fo))},m(Oo,"contents",Fo))),tp=(pn.incomingPort("focusedFetched",Eo({ctor:"::",_0:ko(P),_1:{ctor:"::",_0:m(Mo,F,Fo),_1:{ctor:"[]"}}})),pn.outgoingPort("fetchFocused",function(t){return null}),pn.outgoingPort("save",function(t){return{embedded:t.embedded,input:t.input,automatonText:t.automatonText,automatonTypeString:t.automatonTypeString,editorOptions:{theme:t.editorOptions.theme,themes:U.toArray(t.editorOptions.themes).map(function(t){return t}),runImmediately:t.editorOptions.runImmediately}}})),rp=pn.outgoingPort("replaceAutomatonText",function(t){return t}),np=pn.incomingPort("newAutomatonTextFromEditor",Fo),ep=(s(function(t,r,n){return{theme:t,themes:r,runImmediately:n}}),f(function(t,r,n,e){return{inputAndStateSetsBefore:t,currentStates:r,inputAndStateSetsAfter:n,allStateSetsVisited:e}}),r(function(t,r,n,e,o,c,u){return{cfgDiffBefore:t,curCfg:r,initCfg:n,lastCfg:e,cfgDiffAfter:o,stringOutput:c,currentStep:u}}),function(t){return{parseTreeMaybe:t}}),op=(l(function(t,r){return{contents:t,filename:r}}),t(function(t,r,n,e,o){return{embedded:t,input:r,automatonText:n,automatonTypeString:e,editorOptions:o}}),{ctor:"TMType"}),cp={ctor:"RegexType"},up={ctor:"CFGType"},ip={ctor:"NFAType"},_p={ctor:"DFAType"},ap=function(t){switch(t){case"dfa":return _p;case"nfa":return ip;case"cfg":return up;case"regex":return cp;case"tm":return op;default:return _p}},fp={ctor:"NoAutomaton"},lp=function(t){return{ctor:"T",_0:t}},sp=function(t){return{ctor:"R",_0:t}},dp=function(t){return{ctor:"C",_0:t}},pp=function(t){return{ctor:"N",_0:t}},hp=function(t){return{ctor:"D",_0:t}},gp=l(function(t,r){var c=s(function(n,e,o){var t=function(){var t,r=n;switch(r.ctor){case"D":return m(D,"transition undefined",v(t1,r._0,e,o));case"N":return m(D,"transition undefined",m(J,al,v(q1,r._0,e,(t=o,g.eq(t,Fl)?Vl:Kl(t)))));default:return"no finite automaton defined"}}();return m(N["++"],Tr(o),m(N["++"]," ",m(N["++"],Us,m(N["++"]," ",t))))}),u=f(function(t,r,n,e){var o=m(J,dn,_t(t.inputAndStateSetsAfter)),o=m(Uo,n,t.currentStates)&&(g.eq(F(e),o)||g.eq(e,Fl))?"current ":"";return m(wi,{ctor:"::",_0:Oi(m(N["++"],o,"transition_entry")),_1:{ctor:"::",_0:m(qi,"state",n),_1:{ctor:"::",_0:m(qi,"in_symbol",Tr(e)),_1:{ctor:"::",_0:m(qi,"is_state_cell","false"),_1:{ctor:"[]"}}}}},{ctor:"::",_0:li(v(c,r,n,e)),_1:{ctor:"[]"}})}),i=l(function(t,r){var n=t;switch(n.ctor){case"D":case"N":return m(ct,r,n._0.acceptStates)?"accept":"reject";default:return"no finite automaton defined"}}),n=f(function(t,r,n,e){var o=m(Uo,e,t.currentStates)?"current ":"";return m(yi,{ctor:"::",_0:Di(m(N["++"],"transition-row-",e)),_1:{ctor:"::",_0:m(qi,"state",e),_1:{ctor:"[]"}}},{ctor:"::",_0:m(wi,{ctor:"::",_0:m(qi,"is_state_cell","true"),_1:{ctor:"::",_0:Oi(m(N["++"],o,m(N["++"],"transition_entry_",m(i,r,e)))),_1:{ctor:"[]"}}},{ctor:"::",_0:li(e),_1:{ctor:"[]"}}),_1:m(ft,v(u,t,r,e),n)})}),e=m(yi,{ctor:"::",_0:Di("transition_table_head"),_1:{ctor:"[]"}},{ctor:"::",_0:m(ki,{ctor:"::",_0:Oi("transition_header_entry"),_1:{ctor:"[]"}},{ctor:"::",_0:li("state"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:m(ki,{ctor:"::",_0:Oi("transition_header_entry"),_1:{ctor:"::",_0:ei(100),_1:{ctor:"::",_0:oi("left"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li("transitions"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),o=r;switch(o.ctor){case"NoAutomaton":return li("");case"D":var _=o._0,a=Su(_.delta);return m(Ti,{ctor:"::",_0:Di("transition_table"),_1:{ctor:"[]"}},{ctor:"::",_0:e,_1:m(ft,v(n,t,hp(_),_.inputAlphabet),a)});case"N":_=o._0,a=Su(_.delta);return m(Ti,{ctor:"::",_0:Di("transition_table"),_1:{ctor:"[]"}},{ctor:"::",_0:e,_1:m(ft,v(n,t,pp(_),m(N["++"],_.inputAlphabet,{ctor:"::",_0:Fl,_1:{ctor:"[]"}})),a)});case"T":return li("error: should not have a TM automaton here");case"C":return li("error: should not have a CFG automaton here");default:return li("error: should not have a Regex automaton here")}}),mp=l(function(t,r){var n,e,o,c,u=r;switch(u.ctor){case"FRM":var i=u._0;return m(hi,{ctor:"[]"},{ctor:"::",_0:(c=m(Wd,m(ft,dn,(o=i).inputAndStateSetsAfter),!1),o=m(Wd,dt(m(ft,dn,o.inputAndStateSetsBefore)),!0),m(hi,{ctor:"[]"},{ctor:"::",_0:m(vi,{ctor:"::",_0:Oi("input_processed"),_1:{ctor:"[]"}},{ctor:"::",_0:li("current position: "),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:m(vi,{ctor:"::",_0:Oi("input_processed"),_1:{ctor:"::",_0:Di("input_processed"),_1:{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"font-family",_1:"Consolas"},_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}},{ctor:"::",_0:li(m(N["++"],Yt(o),m(N["++"],"^",Yt(c)))),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}})),_1:{ctor:"::",_0:m(gp,i,t.automaton),_1:{ctor:"[]"}}});case"CRM":var _=Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"float",_1:"left"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"border",_1:"2px solid gray"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"padding",_1:"5px"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"margin",_1:"5px"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"padding",_1:"5px"},_1:{ctor:"[]"}}}}}});return m(hi,{ctor:"[]"},{ctor:"::",_0:m(hi,{ctor:"::",_0:_,_1:{ctor:"[]"}},{ctor:"::",_0:m(mi,{ctor:"[]"},{ctor:"::",_0:li("Production rules:"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:"C"===(e=t.automaton).ctor?m(Ti,{ctor:"[]"},m(ft,Hd,e._0.rules)):li("this should not be displayed; should have a CFG model to view"),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:m(hi,{ctor:"::",_0:_,_1:{ctor:"[]"}},{ctor:"::",_0:m(mi,{ctor:"[]"},{ctor:"::",_0:li("Parse tree:"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:m(pi,{ctor:"::",_0:Di("parse_tree"),_1:{ctor:"[]"}},{ctor:"::",_0:"Just"===(n=u._0.parseTreeMaybe).ctor?li((n=n._0,v(B0,"",!0,n))):li("none"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}),_1:{ctor:"[]"}}});case"RRM":return m(hi,{ctor:"[]"},{ctor:"[]"});case"TRM":i=u._0,_="T"===(e=t.automaton).ctor?e._0:g.crashCase("Main",{start:{line:1075,column:21},end:{line:1080,column:54}},e)("unreachable");return m(hi,{ctor:"[]"},{ctor:"::",_0:li(m(N["++"],"output: ",i.stringOutput)),_1:{ctor:"::",_0:(e=(n=i).curCfg.tapes,n=et(e),m(Ti,{ctor:"[]"},m(ft,Gd,m(Es,e,m(Rt,1,n))))),_1:{ctor:"::",_0:m(jd,i,_),_1:{ctor:"[]"}}}});default:return li("")}}),vp=function(t){return t.embedded?m(hi,{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"padding-left",_1:"5px"},_1:{ctor:"[]"}}),_1:{ctor:"[]"}},{ctor:"::",_0:g.eq(t.errorMsg,"")?m(hi,{ctor:"[]"},{ctor:"::",_0:Vd(t),_1:{ctor:"::",_0:m(mp,t,t.resultModel),_1:{ctor:"[]"}}}):m(hi,{ctor:"[]"},{ctor:"::",_0:m(pi,{ctor:"::",_0:Di("error_message"),_1:{ctor:"[]"}},{ctor:"::",_0:li(t.errorMsg),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}):m(hi,{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"overflow",_1:"auto"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"height",_1:$d(t.windowHeight)},_1:{ctor:"[]"}}}),_1:{ctor:"[]"}},{ctor:"::",_0:m(vi,{ctor:"::",_0:Di("error_message_containing_div"),_1:{ctor:"[]"}},{ctor:"::",_0:m(pi,{ctor:"::",_0:Di("error_message"),_1:{ctor:"[]"}},{ctor:"::",_0:li(t.errorMsg),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:Vd(t),_1:{ctor:"::",_0:m(mp,t,t.resultModel),_1:{ctor:"[]"}}}})},bp={ctor:"NoResult"},Tp={embedded:!1,automaton:fp,automatonType:_p,resultModel:bp,automatonText:v1,input:"",accepted:P,errorMsg:"",editorOptions:{theme:"twilight",themes:{ctor:"::",_0:"chrome",_1:{ctor:"::",_0:"clouds",_1:{ctor:"::",_0:"crimson_editor",_1:{ctor:"::",_0:"dawn",_1:{ctor:"::",_0:"dreamweaver",_1:{ctor:"::",_0:"eclipse",_1:{ctor:"::",_0:"github",_1:{ctor:"::",_0:"iplastic",_1:{ctor:"::",_0:"solarized_light",_1:{ctor:"::",_0:"textmate",_1:{ctor:"::",_0:"tomorrow",_1:{ctor:"::",_0:"xcode",_1:{ctor:"::",_0:"kuroir",_1:{ctor:"::",_0:"katzenmilch",_1:{ctor:"::",_0:"sqlserver",_1:{ctor:"::",_0:"ambiance",_1:{ctor:"::",_0:"chaos",_1:{ctor:"::",_0:"clouds_midnight",_1:{ctor:"::",_0:"cobalt",_1:{ctor:"::",_0:"gruvbox",_1:{ctor:"::",_0:"gob",_1:{ctor:"::",_0:"idle_fingers",_1:{ctor:"::",_0:"kr_theme",_1:{ctor:"::",_0:"merbivore",_1:{ctor:"::",_0:"merbivore_soft",_1:{ctor:"::",_0:"mbo",_1:{ctor:"::",_0:"mono_industrial",_1:{ctor:"::",_0:"monokai",_1:{ctor:"::",_0:"pastel_on_dark",_1:{ctor:"::",_0:"solarized_dark",_1:{ctor:"::",_0:"terminal",_1:{ctor:"::",_0:"tomorrow_night",_1:{ctor:"::",_0:"tomorrow_night_blue",_1:{ctor:"::",_0:"tomorrow_night_bright",_1:{ctor:"::",_0:"tomorrow_night_eighties",_1:{ctor:"::",_0:"twilight",_1:{ctor:"::",_0:"vibrant_ink",_1:{ctor:"[]"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},runImmediately:!0},splitPaneState:su,windowHeight:-1,selected:P},yp=function(t){return g.update(Tp,{embedded:t.embedded,input:t.input,automatonText:t.automatonText,automatonType:ap(t.automatonTypeString),editorOptions:t.editorOptions})},wp=function(t){return{ctor:"TRM",_0:t}},kp=function(t){var r=t.automaton;if("T"!==r.ctor)return g.update(t,{resultModel:bp,accepted:P,errorMsg:"no Turing machine currently loaded"});var n=r._0,e=m(yd,n,t.input),o=m(Dd,n,e);if("Ok"!==o.ctor)return g.update(t,{resultModel:bp,accepted:P,errorMsg:o._0});var c=o._0._1,r=m(wd,n,c.state)?"":m(N["++"],"TM did not halt after ",m(N["++"],A(Cd),m(N["++"]," steps on input ",t.input))),n=m(wd,n,c.state)?F(g.eq(c.state,n.acceptState)):P,c=wp({cfgDiffBefore:{ctor:"[]"},curCfg:e,initCfg:e,lastCfg:c,cfgDiffAfter:o._0._0,stringOutput:Sd(c),currentStep:0});return g.update(t,{accepted:n,resultModel:c,errorMsg:r})},Sp=function(t){return{ctor:"RRM",_0:t}},xp=function(t){var r=t.automaton;if("R"!==r.ctor)return g.update(t,{resultModel:bp,accepted:P,errorMsg:"no regular expression currently loaded"});r=m(G1,r._0,t.input);return g.update(t,{accepted:F(r),resultModel:Sp({ctor:"_Tuple0"}),errorMsg:""})},Bp=function(t){return{ctor:"CRM",_0:t}},Rp=function(t){var r=t.automaton;if("C"!==r.ctor)return g.update(t,{resultModel:bp,accepted:P,errorMsg:"no context-free grammar currently loaded"});r=m(W0,r._0,t.input);return"Just"===r.ctor?g.update(t,{accepted:F(!0),resultModel:Bp(ep(F(r._0))),errorMsg:""}):g.update(t,{accepted:F(!1),resultModel:Bp(ep(P)),errorMsg:""})},Np=function(t){return{ctor:"FRM",_0:t}},Ap=function(r){var t=m(Xd,r.automaton,r.input);if("Ok"!==t.ctor)return g.update(r,{resultModel:bp,accepted:P,errorMsg:t._0});if("::"!==t._0.ctor)return g.update(r,{resultModel:bp,accepted:P,errorMsg:"could not find states visited"});var n=t._0._1,e=t._0._0,o=function(){var t=r.automaton;switch(t.ctor){case"D":case"N":return F(t._0.acceptStates);default:return P}}(),c=m(Es,Zt(r.input),n),t=v(z,l(function(t,r){return!Wo(m(Xo,r,Ko(t)))}),o,_t(dt({ctor:"::",_0:e,_1:m(ft,sn,c)}))),o=function(){r.resultModel;switch(r.automaton.ctor){case"D":case"N":return Np({inputAndStateSetsBefore:{ctor:"[]"},currentStates:e,inputAndStateSetsAfter:c,allStateSetsVisited:{ctor:"::",_0:e,_1:n}});default:return bp}}();return g.update(r,{resultModel:o,accepted:t,errorMsg:""})},qp=function(t){switch(t.automaton.ctor){case"D":case"N":return Ap(t);case"T":return kp(t);case"C":return Rp(t);case"R":return xp(t);default:return t}},Cp=l(function(t,r){var n=t.resultModel;switch(n.ctor){case"FRM":var e=n._0;if(r){var o=e.allStateSetsVisited;return"::"===o.ctor?Np(g.update(e,{inputAndStateSetsBefore:{ctor:"[]"},currentStates:o._0,inputAndStateSetsAfter:m(Es,Zt(t.input),o._1)})):g.crashCase("Main",{start:{line:576,column:17},end:{line:586,column:50}},o)("unreachable")}o=dt(e.allStateSetsVisited);return"::"===o.ctor?Np(g.update(e,{inputAndStateSetsBefore:m(Es,dt(Zt(t.input)),o._1),currentStates:o._0,inputAndStateSetsAfter:{ctor:"[]"}})):Np(e);case"TRM":e=n._0;return wp(r?g.update(e,{cfgDiffBefore:{ctor:"[]"},curCfg:e.initCfg,cfgDiffAfter:m(N["++"],dt(e.cfgDiffBefore),e.cfgDiffAfter),currentStep:0}):g.update(e,{cfgDiffBefore:m(N["++"],dt(e.cfgDiffAfter),e.cfgDiffBefore),curCfg:e.lastCfg,cfgDiffAfter:{ctor:"[]"},currentStep:et(e.cfgDiffBefore)+et(e.cfgDiffAfter)}));case"CRM":return Bp(n._0);case"RRM":return Sp({ctor:"_Tuple0"});default:return bp}}),Mp={ctor:"MinimizeDFA"},Ep=function(t){return{ctor:"SetFocus",_0:t}},Lp=function(t){return{ctor:"WindowHeightUpdated",_0:t}},Op=function(t){return{ctor:"SplitPaneAdjust",_0:t}},Dp=aa({toMsg:(Rl={toMsg:Op,customSplitter:P}).toMsg,splitter:Rl.customSplitter}),Pp=function(t){return{ctor:"FileRead",_0:t}},Ip={ctor:"FileSelected"},Fp=function(t){return{ctor:"SetRunImmediately",_0:t}},Jp=function(t){return{ctor:"NewTheme",_0:t}},zp=function(t){return{ctor:"KeyMsg",_0:t}},Up={ctor:"LastCfg"},Wp={ctor:"FirstCfg"},jp={ctor:"Backward"},Gp={ctor:"Forward"},su=l(function(t,r){t:for(;;){var n=r.editorOptions.runImmediately?kl:R,e=t;switch(e.ctor){case"MinimizeDFA":var o=r.automaton;if("D"!==o.ctor)return{ctor:"_Tuple2",_0:r,_1:Ln};var c=(s=o._0,c=o=c=o=c=u=void 0,u=m1(s),c=Ko(u.states),o=Ko(u.acceptStates),s={ctor:"::",_0:o,_1:{ctor:"::",_0:m(Yo,c,o),_1:{ctor:"[]"}}},c={ctor:"::",_0:o,_1:{ctor:"[]"}},o=s1(u),c=d(_1,o,u.inputAlphabet,s,c),m(f1,c,u)),u=m(N["++"],"// minimized version of DFA that was previously loaded \n\n",(u=c,m(N["++"],"states = ",m(N["++"],gs(u.states),m(N["++"],"\ninput_alphabet = ",m(N["++"],ps(u.inputAlphabet),m(N["++"],"\nstart_state = ",m(N["++"],u.startState,m(N["++"],"\naccept_states = ",m(N["++"],gs(u.acceptStates),m(N["++"],"\ndelta =\n",Y0(u))))))))))));return{ctor:"_Tuple2",_0:c=n(g.update(r,{automaton:hp(c),automatonText:u})),_1:tp(wl(c))};case"SetAutomatonType":return{ctor:"_Tuple2",_0:c=n(g.update(r,{automatonType:e._0})),_1:tp(wl(c))};case"NewAutomatonText":return{ctor:"_Tuple2",_0:c=n(g.update(r,{automatonText:e._0})),_1:tp(wl(c))};case"LoadDefault":u=function(){switch(r.automatonType.ctor){case"DFAType":return v1;case"NFAType":return"// NFA recognizing { x in {0,1}* | third-to-last bit of x is 0 }\nstates = {q1,q2,q3,q4}\ninput_alphabet = {0,1}\nstart_state = q1\naccept_states = {q4}\ndelta =\n q1,0 -> {q1,q2};\n q1,1 -> q1;\n q2,0 -> q3;\n q2,1 -> q3;\n q3,0 -> q4;\n q3,1 -> q4;\n";case"CFGType":return"// CFG generating language of balanced [] parentheses\n\nS -> [S] | SS | ;\n";case"RegexType":return"// matches any binary string containing the substring 010\nB = (0|1)*; // subexpression matching any binary string\nB 010 B";default:return"// TM deciding { w in {0,1}* | w = w^R }\nstates = {s,r00,r11,r01,r10,l,lx,qA,qR}\ninput_alphabet = {0,1}\ntape_alphabet_extra = {x,_}\nstart_state = s\naccept_state = qA\nreject_state = qR\nnum_tapes = 1\ndelta =\n s, 0 -> r00, x, R;\n s, 1 -> r11, x, R;\n r00, 0 -> r00, 0, R;\n r00, 1 -> r01, 1, R;\n r01, 0 -> r00, 0, R;\n r01, 1 -> r01, 1, R;\n r10, 0 -> r10, 0, R;\n r10, 1 -> r11, 1, R;\n r11, 0 -> r10, 0, R;\n r11, 1 -> r11, 1, R;\n r00, _ -> lx, _, L;\n r11, _ -> lx, _, L;\n r00, x -> lx, x, L;\n r11, x -> lx, x, L;\n lx, 0 -> l, x, L;\n lx, 1 -> l, x, L;\n lx, x -> qA, x, S;\n l, 0 -> l, 0, L;\n l, 1 -> l, 1, L;\n l, x -> s, x, R;\n s, x -> qA, x, S;\n"}}();return{ctor:"_Tuple2",_0:c=n(g.update(r,{automatonText:u})),_1:En({ctor:"::",_0:tp(wl(c)),_1:{ctor:"::",_0:rp(u),_1:{ctor:"[]"}}})};case"CompileAndRun":return{ctor:"_Tuple2",_0:kl(r),_1:Ln};case"NewInput":var i=e._0;return{ctor:"_Tuple2",_0:c=r.editorOptions.runImmediately?qp(g.update(r,{input:i})):g.update(r,{input:i}),_1:tp(wl(c))};case"Forward":return{ctor:"_Tuple2",_0:g.update(r,{resultModel:function(t){var r=t;switch(r.ctor){case"FRM":var n=r._0,e=n.inputAndStateSetsAfter;return"::"===e.ctor?Np(g.update(n,{inputAndStateSetsBefore:{ctor:"::",_0:{ctor:"_Tuple2",_0:e._0._0,_1:n.currentStates},_1:n.inputAndStateSetsBefore},currentStates:e._0._1,inputAndStateSetsAfter:e._1})):Np(n);case"TRM":var o=r._0,c=o.cfgDiffAfter;if("[]"===c.ctor)return wp(o);e=c._0,n=m(Nd,e,o.curCfg);return wp(g.update(o,{curCfg:n,cfgDiffBefore:{ctor:"::",_0:e,_1:o.cfgDiffBefore},cfgDiffAfter:c._1,currentStep:o.currentStep+1}));case"CRM":return Bp(r._0);case"RRM":return Sp({ctor:"_Tuple0"});default:return bp}}(r.resultModel)}),_1:Ln};case"Backward":return{ctor:"_Tuple2",_0:g.update(r,{resultModel:function(t){var r=t;switch(r.ctor){case"FRM":var n=r._0,e=n.inputAndStateSetsBefore;return"::"===e.ctor?Np(g.update(n,{inputAndStateSetsBefore:e._1,currentStates:e._0._1,inputAndStateSetsAfter:{ctor:"::",_0:{ctor:"_Tuple2",_0:e._0._0,_1:n.currentStates},_1:n.inputAndStateSetsAfter}})):Np(n);case"TRM":var o=r._0,c=o.cfgDiffBefore;if("[]"===c.ctor)return wp(o);e=c._0,n=m(Bd,e,o.curCfg);return wp(g.update(o,{curCfg:n,cfgDiffAfter:{ctor:"::",_0:e,_1:o.cfgDiffAfter},cfgDiffBefore:c._1,currentStep:o.currentStep-1}));case"CRM":return Bp(r._0);case"RRM":return Sp({ctor:"_Tuple0"});default:return bp}}(r.resultModel)}),_1:Ln};case"FirstCfg":return{ctor:"_Tuple2",_0:g.update(r,{resultModel:m(Cp,r,!0)}),_1:Ln};case"LastCfg":return{ctor:"_Tuple2",_0:g.update(r,{resultModel:m(Cp,r,!1)}),_1:Ln};case"KeyMsg":var _=e._0;if(m(ct,_,{ctor:"::",_0:37,_1:{ctor:"::",_0:Ut(g.chr(",")),_1:{ctor:"[]"}}})){t=jp,r=r;continue t}if(m(ct,_,{ctor:"::",_0:39,_1:{ctor:"::",_0:Ut(g.chr(".")),_1:{ctor:"[]"}}})){t=Gp,r=r;continue t}return{ctor:"_Tuple2",_0:r,_1:Ln};case"NewTheme":var a=r.editorOptions;return{ctor:"_Tuple2",_0:c=g.update(r,{editorOptions:g.update(a,{theme:e._0})}),_1:tp(wl(c))};case"SetRunImmediately":var f=e._0,a=r.editorOptions;return{ctor:"_Tuple2",_0:c=f?kl(g.update(r,{editorOptions:g.update(a,{runImmediately:f})})):g.update(r,{editorOptions:g.update(a,{runImmediately:f})}),_1:tp(wl(c))};case"FileSelected":return{ctor:"_Tuple2",_0:r,_1:Yd("fileUpload")};case"FileRead":var i=e._0,_={contents:i.contents,filename:i.filename},l=(f=void 0,"[]"===(f=dt(m(nr,".",i=_.filename))).ctor?"":m(ar,f._0+1,i)),i=function(){switch(l){case"dfa":return _p;case"nfa":return ip;case"cfg":return up;case"tm":return op;case"regex":return cp;default:return _p}}();return{ctor:"_Tuple2",_0:n(g.update(r,{automatonText:_.contents,automatonType:i})),_1:Ln};case"SplitPaneAdjust":return{ctor:"_Tuple2",_0:g.update(r,{splitPaneState:m(ca,e._0,r.splitPaneState)}),_1:Ln};case"WindowHeightUpdated":return g.cmp(r.windowHeight,0)<0?{ctor:"_Tuple2",_0:g.update(r,{windowHeight:e._0}),_1:Ln}:{ctor:"_Tuple2",_0:r,_1:Ln};default:return{ctor:"_Tuple2",_0:g.update(r,{selected:e._0}),_1:Ln}}}var s,u}),Hp=function(t){return{ctor:"NewInput",_0:t}},Vp={ctor:"LoadDefault"},Kp={ctor:"CompileAndRun"},Qp=function(t){return m(hi,{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"flex",_1:"1 0 0"},_1:{ctor:"[]"}}),_1:{ctor:"[]"}},{ctor:"::",_0:m(xi,{ctor:"::",_0:Di("input"),_1:{ctor:"::",_0:Ii("text"),_1:{ctor:"::",_0:Ji("type input string here"),_1:{ctor:"::",_0:r_(Hp),_1:{ctor:"::",_0:Fi(t.input),_1:{ctor:"::",_0:Yi(Ep(F("input"))),_1:{ctor:"::",_0:Zi(Ep(P)),_1:{ctor:"::",_0:Ci(37),_1:{ctor:"[]"}}}}}}}}},{ctor:"[]"}),_1:{ctor:"::",_0:g.eq(t.automatonType,_p)||g.eq(t.automatonType,ip)||g.eq(t.automatonType,op)?m(vi,{ctor:"[]"},{ctor:"::",_0:m(Bi,{ctor:"::",_0:n_(Wp),_1:{ctor:"::",_0:m(qi,"data-toggle","tooltip"),_1:{ctor:"::",_0:Pi("go to beginning"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li("|<<"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:m(Bi,{ctor:"::",_0:n_(jp),_1:{ctor:"::",_0:m(qi,"data-toggle","tooltip"),_1:{ctor:"::",_0:Pi("backward one step"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li("< (,)"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:m(Bi,{ctor:"::",_0:n_(Gp),_1:{ctor:"::",_0:m(qi,"data-toggle","tooltip"),_1:{ctor:"::",_0:Pi("forward one step"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li("> (.)"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:m(Bi,{ctor:"::",_0:n_(Up),_1:{ctor:"::",_0:m(qi,"data-toggle","tooltip"),_1:{ctor:"::",_0:Pi("go to end"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li(">>|"),_1:{ctor:"[]"}}),_1:{ctor:"[]"}}}}}):m(vi,{ctor:"[]"},{ctor:"[]"}),_1:{ctor:"::",_0:m(bi,{ctor:"[]"},{ctor:"[]"}),_1:{ctor:"::",_0:m(Si,{ctor:"::",_0:m(qi,"data-toggle","tooltip"),_1:{ctor:"::",_0:Pi('Toggle whether automaton is automatically compiled and run whenever the automaton description or input changes. If unselected, a "Run" button appears that must be pressed. The latter is convenient for long-running processes such as a non-halting Turing machine.'),_1:{ctor:"[]"}}},{ctor:"::",_0:li("Run immediately?"),_1:{ctor:"::",_0:m(xi,{ctor:"::",_0:Ii("checkbox"),_1:{ctor:"::",_0:t_(Fp),_1:{ctor:"::",_0:Hi(t.editorOptions.runImmediately),_1:{ctor:"[]"}}}},{ctor:"[]"}),_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:t.editorOptions.runImmediately?li(""):m(Bi,{ctor:"::",_0:n_(Kp),_1:{ctor:"::",_0:m(qi,"data-toggle","tooltip"),_1:{ctor:"::",_0:Pi("run automaton on current input"),_1:{ctor:"[]"}}}},{ctor:"::",_0:li("Run"),_1:{ctor:"[]"}}),_1:{ctor:"::",_0:"TRM"===(t=t.resultModel).ctor?m(vi,{ctor:"[]"},{ctor:"::",_0:li("step:"),_1:{ctor:"::",_0:li(A(t._0.currentStep)),_1:{ctor:"[]"}}}):li(""),_1:{ctor:"[]"}}}}}}})},$p=function(t){return{ctor:"NewAutomatonText",_0:t}},Xp=function(t){if(Qd){var r=zd(t.automatonType);return m(Nl,{ctor:"::",_0:Di("editor"),_1:{ctor:"::",_0:m(Xi,"focusin",m(Mo,Ep,Ro(F("editor")))),_1:{ctor:"::",_0:m(Xi,"focusout",m(Mo,Ep,Ro(P))),_1:{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"height",_1:"100%"},_1:{ctor:"[]"}}),_1:{ctor:"::",_0:Ol(t.editorOptions.theme),_1:{ctor:"::",_0:Ll(r),_1:{ctor:"::",_0:El(t.automatonText),_1:{ctor:"::",_0:Cl(!0),_1:{ctor:"::",_0:Ml(!1),_1:{ctor:"::",_0:ql(!0),_1:{ctor:"::",_0:Al($p),_1:{ctor:"[]"}}}}}}}}}}}},{ctor:"[]"})}return m(Ai,{ctor:"::",_0:Di("editor"),_1:{ctor:"::",_0:Vi({ctor:"::",_0:{ctor:"_Tuple2",_0:"width",_1:"99%"},_1:{ctor:"::",_0:{ctor:"_Tuple2",_0:"height",_1:"98%"},_1:{ctor:"[]"}}}),_1:{ctor:"::",_0:r_($p),_1:{ctor:"::",_0:Fi(t.automatonText),_1:{ctor:"::",_0:m(Xi,"focusin",m(Mo,Ep,Ro(F("editor")))),_1:{ctor:"::",_0:m(Xi,"focusout",m(Mo,Ep,Ro(P))),_1:{ctor:"[]"}}}}}}},{ctor:"[]"})},Yp=function(t){return 0 q;\n q0,1 -> q;\n q00,1 -> q;\n q000,1 -> q;\n\n // if we see a 0, count one more 0 than before\n q,0 -> q0;\n q0,0 -> q00;\n q00,0 -> q000;\n\n // until we get to three\n q000,0 -> q000;\n",
+ automatonTypeString: "dfa",
+ editorOptions: {
+ runImmediately: true,
+ theme: "twilight",
+ themes: [
+ "chrome",
+ "clouds",
+ "crimson_editor",
+ "dawn",
+ "dreamweaver",
+ "eclipse",
+ "github",
+ "iplastic",
+ "solarized_light",
+ "textmate",
+ "tomorrow",
+ "xcode",
+ "kuroir",
+ "katzenmilch",
+ "sqlserver",
+ "ambiance",
+ "chaos",
+ "clouds_midnight",
+ "cobalt",
+ "gruvbox",
+ "gob",
+ "idle_fingers",
+ "kr_theme",
+ "merbivore",
+ "merbivore_soft",
+ "mbo",
+ "mono_industrial",
+ "monokai",
+ "pastel_on_dark",
+ "solarized_dark",
+ "terminal",
+ "tomorrow_night",
+ "tomorrow_night_blue",
+ "tomorrow_night_bright",
+ "tomorrow_night_eighties",
+ "twilight",
+ "vibrant_ink"]
+ }
+};
diff --git a/src/file-upload.js b/src/file-upload.js
new file mode 100644
index 0000000..9e8cad3
--- /dev/null
+++ b/src/file-upload.js
@@ -0,0 +1,38 @@
+
+// below is taken from https://www.paramander.com/blog/using-ports-to-deal-with-files-in-elm-0-17
+app.ports.fileSelected.subscribe(function (id) {
+ var node = document.getElementById(id);
+ if (node === null) {
+ return;
+ }
+
+ // If your file upload field allows multiple files, you might
+ // want to consider turning this into a `for` loop.
+ var file = node.files[0];
+ var reader = new FileReader();
+
+ // FileReader API is event based. Once a file is selected
+ // it fires events. We hook into the `onload` event for our reader.
+ reader.onload = (function(event) {
+ // The event carries the `target`. The `target` is the file
+ // that was selected. The result is base64 encoded contents of the file.
+ var base64encoded = event.target.result;
+ console.log(base64encoded);
+ // We build up the `ImagePortData` object here that will be passed to our Elm
+ // runtime through the `fileContentRead` subscription.
+ var portData = {
+ contents: base64encoded,
+ filename: file.name
+ };
+
+ // We call the `fileContentRead` port with the file data
+ // which will be sent to our Elm runtime via Subscriptions.
+ app.ports.fileContentRead.send(portData);
+ });
+
+ // Connect our FileReader with the file that was selected in our `input` node.
+ // reader.readAsDataURL(file);
+ if (typeof file !== 'undefined') {
+ reader.readAsText(file);
+ }
+});
diff --git a/src/get-ace-themes.js b/src/get-ace-themes.js
new file mode 100644
index 0000000..98de993
--- /dev/null
+++ b/src/get-ace-themes.js
@@ -0,0 +1,67 @@
+// define(function(require, exports, module) {
+// "use strict";
+// require("ace/lib/fixoldbrowsers");
+
+ var themeData = [
+ ["Chrome" ],
+ ["Clouds" ],
+ ["Crimson Editor" ],
+ ["Dawn" ],
+ ["Dreamweaver" ],
+ ["Eclipse" ],
+ ["GitHub" ],
+ ["IPlastic" ],
+ ["Solarized Light"],
+ ["TextMate" ],
+ ["Tomorrow" ],
+ ["XCode" ],
+ ["Kuroir"],
+ ["KatzenMilch"],
+ ["SQL Server" ,"sqlserver" , "light"],
+ ["Ambiance" ,"ambiance" , "dark"],
+ ["Chaos" ,"chaos" , "dark"],
+ ["Clouds Midnight" ,"clouds_midnight" , "dark"],
+ ["Cobalt" ,"cobalt" , "dark"],
+ ["Gruvbox" ,"gruvbox" , "dark"],
+ ["Green on Black" ,"gob" , "dark"],
+ ["idle Fingers" ,"idle_fingers" , "dark"],
+ ["krTheme" ,"kr_theme" , "dark"],
+ ["Merbivore" ,"merbivore" , "dark"],
+ ["Merbivore Soft" ,"merbivore_soft" , "dark"],
+ ["mbo" ,"mbo" , "dark"],
+ ["Mono Industrial" ,"mono_industrial" , "dark"],
+ ["Monokai" ,"monokai" , "dark"],
+ ["Pastel on dark" ,"pastel_on_dark" , "dark"],
+ ["Solarized Dark" ,"solarized_dark" , "dark"],
+ ["Terminal" ,"terminal" , "dark"],
+ ["Tomorrow Night" ,"tomorrow_night" , "dark"],
+ ["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
+ ["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
+ ["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
+ ["Twilight" ,"twilight" , "dark"],
+ ["Vibrant Ink" ,"vibrant_ink" , "dark"]
+ ];
+
+
+ themesByName = {};
+ themeNames = [];
+
+ /**
+ * An array containing information about available themes.
+ */
+ themes = themeData.map(function(data) {
+ var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
+ var theme = {
+ caption: data[0],
+ theme: "ace/theme/" + name,
+ isDark: data[2] == "dark",
+ name: name
+ };
+ themesByName[name] = theme;
+ themeNames.push(name);
+ return theme;
+ });
+
+
+
+// });
diff --git a/src/mode-cfg.js b/src/mode-cfg.js
new file mode 100644
index 0000000..54b8ba9
--- /dev/null
+++ b/src/mode-cfg.js
@@ -0,0 +1,62 @@
+
+// below is copied (without much understanding on my part except the state machine from https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode
+
+// https://ace.c9.io/tool/mode_creator.html
+// https://cloud9-sdk.readme.io/docs/highlighting-rules // don't pay attention to this; it's insufficient
+
+
+define('ace/mode/cfg', function(require, exports, module) {
+ var oop = require("ace/lib/oop");
+ var TextMode = require("ace/mode/text").Mode;
+ var cfgHighlightRules = require("ace/mode/cfg_highlight_rules").cfgHighlightRules;
+
+ var Mode = function() {
+ this.HighlightRules = cfgHighlightRules;
+ };
+ oop.inherits(Mode, TextMode);
+
+ (function() {
+ // Extra logic goes here. (see below)
+ }).call(Mode.prototype);
+
+ exports.Mode = Mode;
+});
+
+define('ace/mode/cfg_highlight_rules', function(require, exports, module) {
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
+
+ var cfgHighlightRules = function() {
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ //TODO: re-write this to look nice for CFGs
+ var comment = { regex: /\/\/.*/, token: "comment" };
+ var alphabetRegex = /(?:\w|~|!|@|%|&|_|'|<|>|#|"|\:|\.|\\|\+|\*|\?|\[|\^|\]|\$|\(|\)|\=|\!|\<|\>)/;
+ var operator = /[\|;]/;
+
+ this.$rules = {
+ start: [
+ {regex: alphabetRegex, token: "keyword", next: "production_rule_op"},
+ comment
+ ],
+ production_rule_op: [
+ {regex: /->/, token: "operator", next: "production_rule_out"},
+ comment
+ ],
+ production_rule_out: [
+ {regex: alphabetRegex, token: "string"},
+ {regex: /\|/, token: "operator"},
+ {regex: /;/, token: "operator", next: "production_rule_in"},
+ comment
+ ],
+ production_rule_in: [
+ {regex: alphabetRegex, token: "string", next: "production_rule_op"},
+ comment
+ ]
+ };
+ };
+
+ oop.inherits(cfgHighlightRules, TextHighlightRules);
+ exports.cfgHighlightRules = cfgHighlightRules;
+});
diff --git a/src/mode-dfa.js b/src/mode-dfa.js
new file mode 100644
index 0000000..7605843
--- /dev/null
+++ b/src/mode-dfa.js
@@ -0,0 +1,108 @@
+
+// below is copied (without much understanding on my part except the state machine from https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode
+
+// https://ace.c9.io/tool/mode_creator.html
+// https://cloud9-sdk.readme.io/docs/highlighting-rules // don't pay attention to this; it's insufficient
+
+
+define('ace/mode/dfa', function(require, exports, module) {
+ var oop = require("ace/lib/oop");
+ var TextMode = require("ace/mode/text").Mode;
+ var dfaHighlightRules = require("ace/mode/dfa_highlight_rules").dfaHighlightRules;
+
+ var Mode = function() {
+ this.HighlightRules = dfaHighlightRules;
+ };
+ oop.inherits(Mode, TextMode);
+
+ (function() {
+ // Extra logic goes here. (see below)
+ }).call(Mode.prototype);
+
+ exports.Mode = Mode;
+});
+
+define('ace/mode/dfa_highlight_rules', function(require, exports, module) {
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
+
+ var dfaHighlightRules = function() {
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ var comment = { regex: /\/\/.*$/, token: "comment" };
+ var setOperator = { regex: /{|,|}/, token: "operator" };
+ var state = { regex: /[\w$]+/, token: "variable" };
+ // var alphabetSymbol = { regex: /[\w~!@%&_'<>#"\.\\\+\*\?\[\^\]\$\(\)\=\!\<\>\|\:]/, token: "string" };
+ var alphabetSymbol = { regex: /(?:\w|~|!|@|%|&|_|'|<|>|#|"|\:|\.|\\|\+|\*|\?|\[|\^|\]|\$|\(|\)|\=|\!|\<|\>|\|)/, token: "string" };
+ var defnOperator = /=/;
+
+ this.$rules = {
+ start: [
+ {regex: /states/, token: "keyword", next: "states_keyword_read"},
+ comment
+ ],
+ states_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "states"},
+ comment
+ ],
+ states: [
+ {regex: /input_alphabet/, token: "keyword", next: "input_alphabet_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ state,
+ comment
+ ],
+ input_alphabet_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "input_alphabet"},
+ comment
+ ],
+ input_alphabet: [
+ {regex: /start_state/, token: "keyword", next: "start_state_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ alphabetSymbol,
+ comment
+ ],
+ start_state_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "start_state"},
+ comment
+ ],
+ start_state: [
+ {regex: /accept_states/, token: "keyword", next: "accept_states_keyword_read"},
+ state,
+ comment
+ ],
+ accept_states_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "accept_states"},
+ comment
+ ],
+ accept_states: [
+ {regex: /delta/, token: "keyword", next: "delta_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ state,
+ comment
+ ],
+ delta_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "delta_in_state"},
+ comment
+ ],
+ delta_in_state: [
+ state,
+ {regex: /,/, token: "operator", next: "delta_in_symbol"},
+ comment
+ ],
+ delta_in_symbol: [
+ alphabetSymbol,
+ {regex: /->/, token: "operator", next: "delta_out_state"},
+ comment
+ ],
+ delta_out_state: [
+ state,
+ {regex: /;/, token: "operator", next: "delta_in_state"},
+ comment
+ ]
+ };
+ };
+
+ oop.inherits(dfaHighlightRules, TextHighlightRules);
+ exports.dfaHighlightRules = dfaHighlightRules;
+});
diff --git a/src/mode-nfa.js b/src/mode-nfa.js
new file mode 100644
index 0000000..01bc7a5
--- /dev/null
+++ b/src/mode-nfa.js
@@ -0,0 +1,109 @@
+
+// below is copied (without much understanding on my part except the state machine from https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode
+
+// https://ace.c9.io/tool/mode_creator.html
+// https://cloud9-sdk.readme.io/docs/highlighting-rules // don't pay attention to this; it's insufficient
+
+
+define('ace/mode/nfa', function(require, exports, module) {
+ var oop = require("ace/lib/oop");
+ var TextMode = require("ace/mode/text").Mode;
+ var nfaHighlightRules = require("ace/mode/nfa_highlight_rules").nfaHighlightRules;
+
+ var Mode = function() {
+ this.HighlightRules = nfaHighlightRules;
+ };
+ oop.inherits(Mode, TextMode);
+
+ (function() {
+ // Extra logic goes here. (see below)
+ }).call(Mode.prototype);
+
+ exports.Mode = Mode;
+});
+
+define('ace/mode/nfa_highlight_rules', function(require, exports, module) {
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
+
+ var nfaHighlightRules = function() {
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ var comment = { regex: /\/\/.*/, token: "comment" };
+ var setOperator = { regex: /{|,|}/, token: "operator" };
+ var state = { regex: /[\w$]+/, token: "variable" };
+ // var alphabetSymbol = { regex: /[\w~!@%&_'<>#"\.\\\+\*\?\[\^\]\$\(\)\=\!\<\>\|\:]/, token: "string" };
+ var alphabetSymbol = { regex: /(?:\w|~|!|@|%|&|_|'|<|>|#|"|\:|\.|\\|\+|\*|\?|\[|\^|\]|\$|\(|\)|\=|\!|\<|\>|\|)/, token: "string" };
+ var defnOperator = /=/;
+
+ this.$rules = {
+ start: [
+ {regex: /states/, token: "keyword", next: "states_keyword_read"},
+ comment
+ ],
+ states_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "states"},
+ comment
+ ],
+ states: [
+ {regex: /input_alphabet/, token: "keyword", next: "input_alphabet_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ state,
+ comment
+ ],
+ input_alphabet_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "input_alphabet"},
+ comment
+ ],
+ input_alphabet: [
+ {regex: /start_state/, token: "keyword", next: "start_state_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ alphabetSymbol,
+ comment
+ ],
+ start_state_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "start_state"},
+ comment
+ ],
+ start_state: [
+ {regex: /accept_states/, token: "keyword", next: "accept_states_keyword_read"},
+ state,
+ comment
+ ],
+ accept_states_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "accept_states"},
+ comment
+ ],
+ accept_states: [
+ {regex: /delta/, token: "keyword", next: "delta_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ state,
+ comment
+ ],
+ delta_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "delta_in_state"},
+ comment
+ ],
+ delta_in_state: [
+ state,
+ {regex: /,/, token: "operator", next: "delta_in_symbol"},
+ comment
+ ],
+ delta_in_symbol: [
+ alphabetSymbol,
+ {regex: /->/, token: "operator", next: "delta_out_state"},
+ comment
+ ],
+ delta_out_state: [
+ state,
+ {regex: /{|,|}/, token: "operator"},
+ {regex: /;/, token: "operator", next: "delta_in_state"},
+ comment
+ ]
+ };
+ };
+
+ oop.inherits(nfaHighlightRules, TextHighlightRules);
+ exports.nfaHighlightRules = nfaHighlightRules;
+});
diff --git a/src/mode-regex.js b/src/mode-regex.js
new file mode 100644
index 0000000..697e75f
--- /dev/null
+++ b/src/mode-regex.js
@@ -0,0 +1,47 @@
+
+// below is copied (without much understanding on my part except the state machine from https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode
+
+// https://ace.c9.io/tool/mode_creator.html
+// https://cloud9-sdk.readme.io/docs/highlighting-rules // don't pay attention to this; it's insufficient
+
+
+define('ace/mode/regex', function(require, exports, module) {
+ var oop = require("ace/lib/oop");
+ var TextMode = require("ace/mode/text").Mode;
+ var regexHighlightRules = require("ace/mode/regex_highlight_rules").regexHighlightRules;
+
+ var Mode = function() {
+ this.HighlightRules = regexHighlightRules;
+ };
+ oop.inherits(Mode, TextMode);
+
+ (function() {
+ // Extra logic goes here. (see below)
+ }).call(Mode.prototype);
+
+ exports.Mode = Mode;
+});
+
+define('ace/mode/regex_highlight_rules', function(require, exports, module) {
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
+
+ var regexHighlightRules = function() {
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ var comment = { regex: /\/\/.*/, token: "comment" };
+ var alphabetSymbol = { regex: /(?:\w|@|\.)/, token: "string" };
+
+ this.$rules = {
+ start: [
+ comment,
+ { regex: /(?:\*|\+|\||\(|\))/, token: "operator" },
+ alphabetSymbol
+ ]
+ };
+ };
+
+ oop.inherits(regexHighlightRules, TextHighlightRules);
+ exports.regexHighlightRules = regexHighlightRules;
+});
diff --git a/src/mode-tm.js b/src/mode-tm.js
new file mode 100644
index 0000000..f61f969
--- /dev/null
+++ b/src/mode-tm.js
@@ -0,0 +1,150 @@
+
+// below is copied (without much understanding on my part except the state machine from https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode
+
+// https://ace.c9.io/tool/mode_creator.html
+// https://cloud9-sdk.readme.io/docs/highlighting-rules // don't pay attention to this; it's insufficient
+
+
+define('ace/mode/tm', function(require, exports, module) {
+ var oop = require("ace/lib/oop");
+ var TextMode = require("ace/mode/text").Mode;
+ var tmHighlightRules = require("ace/mode/tm_highlight_rules").tmHighlightRules;
+
+ var Mode = function() {
+ this.HighlightRules = tmHighlightRules;
+ };
+ oop.inherits(Mode, TextMode);
+
+ (function() {
+ // Extra logic goes here. (see below)
+ }).call(Mode.prototype);
+
+ exports.Mode = Mode;
+});
+
+define('ace/mode/tm_highlight_rules', function(require, exports, module) {
+ var oop = require("../lib/oop");
+ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
+
+ var tmHighlightRules = function() {
+ // regexp must not have capturing parentheses. Use (?:) instead.
+ // regexps are ordered -> the first match is used
+
+ var comment = { regex: /\/\/.*/, token: "comment" };
+ var setOperator = { regex: /{|,|}/, token: "operator" };
+ var state = { regex: /[\w$]+/, token: "variable" };
+ // var alphabetSymbol = { regex: /[\w~!@%&_'<>#"\.\\\+\*\?\[\^\]\$\(\)\=\!\<\>\|\:]/, token: "string" };
+ var alphabetSymbol = { regex: /(?:\w|~|!|@|%|&|_|'|<|>|#|"|\:|\.|\\|\+|\*|\?|\[|\^|\]|\$|\(|\)|\=|\!|\<|\>|\|)/, token: "string" };
+ var moves = { regex: /(?:L|R|S)/,
+ token: "keyword"
+ // token: "variable"
+ // token: "number"
+ };
+ var defnOperator = /=/;
+
+ this.$rules = {
+ start: [
+ {regex: /states/, token: "keyword", next: "states_keyword_read"},
+ comment
+ ],
+ states_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "states"},
+ comment
+ ],
+ states: [
+ {regex: /input_alphabet/, token: "keyword", next: "input_alphabet_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ state,
+ comment
+ ],
+ input_alphabet_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "input_alphabet"},
+ comment
+ ],
+ input_alphabet: [
+ {regex: /tape_alphabet_extra/, token: "keyword", next: "tape_alphabet_extra_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ alphabetSymbol,
+ comment
+ ],
+ tape_alphabet_extra_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "tape_alphabet_extra"},
+ comment
+ ],
+ tape_alphabet_extra: [
+ {regex: /start_state/, token: "keyword", next: "start_state_keyword_read"},
+ {regex: /{|,|}/, token: "operator"},
+ alphabetSymbol,
+ comment
+ ],
+ start_state_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "start_state"},
+ comment
+ ],
+ start_state: [
+ {regex: /accept_state/, token: "keyword", next: "accept_state_keyword_read"},
+ state,
+ comment
+ ],
+ accept_state_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "accept_state"},
+ comment
+ ],
+ accept_state: [
+ {regex: /reject_state/, token: "keyword", next: "reject_state_keyword_read"},
+ state,
+ comment
+ ],
+ reject_state_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "reject_state"},
+ comment
+ ],
+ reject_state: [
+ {regex: /num_tapes/, token: "keyword", next: "num_tapes_keyword_read"},
+ state,
+ comment
+ ],
+ num_tapes_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "num_tapes"},
+ comment
+ ],
+ num_tapes: [
+ {regex: /delta/, token: "keyword", next: "delta_keyword_read"},
+ state,
+ comment
+ ],
+ delta_keyword_read: [
+ {regex: defnOperator, token: "operator", next: "delta_in_state"},
+ comment
+ ],
+ delta_in_state: [
+ state,
+ {regex: /,/, token: "operator", next: "delta_in_symbols"},
+ comment
+ ],
+ delta_in_symbols: [
+ alphabetSymbol,
+ {regex: /->/, token: "operator", next: "delta_out_state"},
+ comment
+ ],
+ delta_out_state: [
+ state,
+ {regex: /,/, token: "operator", next: "delta_out_symbols"},
+ comment
+ ],
+ delta_out_symbols: [
+ alphabetSymbol,
+ {regex: /,/, token: "operator", next: "delta_out_moves"},
+ comment
+ ],
+ delta_out_moves: [
+ moves,
+ {regex: /;/, token: "operator", next: "delta_in_state"},
+ comment
+ ]
+ };
+ };
+
+ oop.inherits(tmHighlightRules, TextHighlightRules);
+ exports.tmHighlightRules = tmHighlightRules;
+});
diff --git a/styles.css b/styles.css
new file mode 100644
index 0000000..bfbf0bd
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,131 @@
+@import url(https://fonts.googleapis.com/css?family=Roboto);
+
+html, body {
+ margin: 0px;
+ padding: 5px;
+ font-family: 'Roboto', sans-serif;
+}
+
+div.input_processed, div.enter_new_file, div.tm_output {
+ display: inline;
+}
+
+#drop-zone {
+ border: 2px dashed #bbb;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ color: #bbb;
+ font-size: 20pt;
+ font-weight: bold;
+ padding: 25px;
+ text-align: center;
+}
+
+#drop-zone.hover {
+ background-color: #def;
+ border-color: #777;
+ color: #777;
+}
+
+.tt {
+ font-family: "Consolas";
+ display:inline;
+}
+
+.title {
+ margin: "2pt";
+ padding: "2pt";
+ font-weight: "bold";
+ font-size: "20px";
+ background-color: "lightgray";
+}
+
+.transition_header_entry {
+ background-color: #dddddd;
+ padding: 3px;
+}
+
+.transition_entry {
+ border: 3px solid #bbb;
+ padding: 3px;
+ border-radius: 8px;
+}
+
+.production_rule_entry {
+ background-color: #dddddd;
+ padding: 3px;
+}
+
+.production_rule_entry {
+ border: 3px solid #bbb;
+ padding: 3px;
+ border-radius: 8px;
+}
+
+.transition_entry_accept {
+ border: 5px solid #0c0;
+ padding: 3px;
+ border-radius: 8px;
+}
+
+.transition_entry_reject {
+ border: 5px solid #f00;
+ padding: 3px;
+ border-radius: 8px;
+}
+
+.current {
+ background-color: cyan;
+}
+
+
+.regex_label {
+ width: 60px;
+ display:inline-block;
+}
+
+.tm_output {
+ display: inline;
+}
+
+
+td.tape_cell {
+ border: 1px solid black;
+ border-collapse: collapse;
+}
+
+th.tape_header_cell, td.tape_cell {
+ padding: 5px;
+ width: 18px;
+ text-align: center;
+}
+
+table#tape_table {
+ padding-top: 10px;
+ padding-bottom: 20px;
+}
+
+.transition_output_field {
+ padding-left: 8px;
+ padding-right: 8px;
+ display: inline;
+}
+
+#error_message_containing_div {
+ overflow: auto;
+}
+
+#error_message {
+ color: red;
+ white-space: pre-wrap;
+}
+
+.hover-item {
+ background-color: white;
+ text-decoration: none;
+}
+
+.hover-item:hover {
+ background-color: lightblue;
+}