first import book

This commit is contained in:
Johann Dreo 2015-03-03 15:56:44 +01:00
commit dfd9c869d5
233 changed files with 47797 additions and 0 deletions

0
book/common/.gitignore vendored Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -0,0 +1,36 @@
.modal-profile {
display:none;
min-height: 300px;
overflow: hidden;
width: 700px;
padding:25px;
border:1px solid #fff;
box-shadow: 0px 2px 7px #292929;
-moz-box-shadow: 0px 2px 7px #292929;
-webkit-box-shadow: 0px 2px 7px #292929;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
background: #f2f2f2;
z-index:50;
}
.modal-lightsout {
display:none;
position:absolute;
top:0;
left:0;
width:100%;
z-index:25;
background:#000 ;
}
.modal-close-profile {
display:none;
position:absolute;
height: 43px;
width: 43px;
background-image: url('close.png');
top:1px;
right:0.5px;
}

View file

@ -0,0 +1,202 @@
.CodeMirror {
line-height: 20px;
font-family: monospace;
border-right: 2px solid #aaa;
border-top: 2px solid #aaa;
border-bottom: 2px solid #aaa;
border-left: 2px solid #aaa;
/* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
position: relative;
/* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
overflow: hidden;
}
.CodeMirror-scroll {
overflow: auto;
height: auto;
max-height: 300px;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
outline: none;
}
/* Vertical scrollbar */
.CodeMirror-scrollbar {
position: absolute;
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
z-index: 5;
}
.CodeMirror-scrollbar-inner {
/* This needs to have a nonzero width in order for the scrollbar to appear
in Firefox and IE9. */
width: 1px;
}
.CodeMirror-scrollbar.cm-sb-overlap {
/* Ensure that the scrollbar appears in Lion, and that it overlaps the content
rather than sitting to the right of it. */
position: absolute;
z-index: 1;
float: none;
right: 0;
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-nonoverlap {
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-ie7 {
min-width: 18px;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
cursor: default;
}
.CodeMirror-lines {
padding: .4em;
white-space: pre;
cursor: text;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: Monaco, Courier New, monospace;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
overflow: visible;
}
.admonition .CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: Monaco, Courier New, monospace;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
outline: none !important;
}
.CodeMirror pre.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black;
border-right: none;
width: 0;
}
.cm-keymap-fat-cursor pre.CodeMirror-cursor {
width: auto;
border: 0;
background: transparent;
background: rgba(0, 200, 0, .4);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
}
/* Kludge to turn off filter in ie9+, which also accepts rgba */
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
.CodeMirror-focused pre.CodeMirror-cursor {
visibility: visible;
}
div.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* Default theme */
.cm-s-default span.cm-keyword {color: #708;}
.cm-s-default span.cm-atom {color: #219;}
.cm-s-default span.cm-number {color: #164;}
.cm-s-default span.cm-def {color: #00f;}
.cm-s-default span.cm-variable {color: black;}
.cm-s-default span.cm-variable-2 {color: #05a;}
.cm-s-default span.cm-variable-3 {color: #085;}
.cm-s-default span.cm-property {color: black;}
.cm-s-default span.cm-operator {color: black;}
.cm-s-default span.cm-comment {color: #a50;}
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #997;}
.cm-s-default span.cm-tag {color: #170;}
.cm-s-default span.cm-attribute {color: #00c;}
.cm-s-default span.cm-header {color: blue;}
.cm-s-default span.cm-quote {color: #090;}
.cm-s-default span.cm-hr {color: #999;}
.cm-s-default span.cm-link {color: #00c;}
span.cm-negative {color: #d44;}
span.cm-positive {color: #292;}
span.cm-header, span.cm-strong {font-weight: bold;}
span.cm-em {font-style: italic;}
span.cm-emstrong {font-style: italic; font-weight: bold;}
span.cm-link {text-decoration: underline;}
span.cm-invalidchar {color: #f00;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
/* bnm - add from codemirror website. The mysterious re-occuring tabs */
.cm-tab {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=);
background-position: right;
background-repeat: no-repeat;
}
@media print {
/* Hide the cursor when printing */
.CodeMirror pre.CodeMirror-cursor {
visibility: hidden;
}
}

View file

@ -0,0 +1,414 @@
/*
Online Python Tutor
Copyright (C) 2010 Philip J. Guo (philip@pgbovine.net)
https://github.com/pgbovine/OnlinePythonTutor/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Color scheme ideas:
Current scheme: pastel blue and yellow with a hint of red:
http://colorschemedesigner.com/#3N32mmmuew0w0
Primary Color:
3D58A2 41507A 142B69 6F89D1 899CD1
Secondary Color A:
EBF048 B1B456 989C17 F4F776 F5F798
Secondary Color B:
F15149 B55B56 9D1E18 F87D76 F89D99
Alternates:
pastel green, yellow, and purple:
http://colorschemedesigner.com/#2P32PbX--w0w0
Primary Color:
A0FFA0 8ABF8A 34A634 B8FFB8 CBFFCB
Secondary Color A:
FFEFA0 BFB68A A69234 FFF3B8 FFF6CB
Secondary Color B:
BFABFF 9B90BF 5237A6 CFC0FF DCD1FF
pastel blue and yellow:
http://colorschemedesigner.com/#0W21TjruJw0w0
Primary Color:
F5C260 B89B64 9F741F FAD388 FADEA6
Complementary Color:
4A67A4 49597B 18326A 7C97D1 93A7D1
*/
#pyInput {
font-size: 10pt;
font-family: Andale mono, monospace;
/*font-weight: bold;*/
padding: 8px;
margin-top: 5px;
}
#pyInputPane {
text-align: center;
margin-bottom: 40px;
}
table.pyOutputPane {
padding: 15px;
}
#dataViz {
margin-left: 30px;
}
table.frameDataViz {
border-spacing: 0px;
font-size: 10pt;
margin-top: 5px;
margin-left: 15px;
background-color: #dddddd;
padding: 5px;
}
table.frameDataViz td.varname {
text-align: right;
padding: 5px;
padding-right: 8px;
border-right: 1px dashed #888888;
}
table.frameDataViz td.val {
padding-left: 8px;
padding-right: 5px;
padding-top: 8px;
padding-bottom: 8px;
}
div.pyCodeOutputDiv {
max-width: 550px;
max-height: 620px;
overflow: auto;
margin-left: 30px;
/*margin-bottom: 4px;*/
}
table.pyCodeOutput {
font-family: Andale mono, monospace;
font-size:10pt;
line-height:1.1em;
border-spacing: 0px;
border-top: 1px solid #999999;
padding-top: 3px;
border-bottom: 1px solid #999999;p
margin-bottom: 20px;
padding-bottom: 20px;
}
/* don't wrap lines within code output ... FORCE scrollbars to appear */
table.pyCodeOutput td {
white-space: nowrap;
}
table.pyCodeOutput .lineNo {
background-color:#FFFFFF;
color:#AAAAAA;
margin:0;
/* padding:0.2em; */
padding-right:0.5em;
text-align:right;
width:3.1em;
}
tabl.#pyCodeOutput .cod {
/*font-weight: bold;*/
margin-left: 3px;
padding-left: 7px;
text-align: left; /* necessary or else doesn't work properly in IE */
}
div#editCodeLinkDiv {
text-align: center;
margin-top: 6px;
}
#editCodeLinkOnError {
color: #142B69;
}
.errorOutput {
background-color: #F87D76;
font-size: 12pt;
padding: 2px;
line-height: 1.5em;
margin-bottom: 4px;
}
.warningOutput {
font-size: 9pt;
color: #666666;
}
button.bigBtn {
font-size: 14pt;
padding: 3px;
}
/* VCR control buttons for stepping through execution */
.vcrControls {
margin-top: 10px;
margin-bottom: 20px;
}
.vcrControls button {
margin-left: 5px;
margin-right: 5px;
}
#pyStdout {
border: 1px solid #999999;
font-size: 10pt;
padding: 4px;
font-family: Andale mono, monospace;
}
.vizFrame {
margin-bottom: 20px;
/* padding-left: 8px;
/* border-left: 2px solid #cccccc; */
}
/* Python data value rendering */
.nullObj {
color: #444444;
}
.numberObj {
}
.boolObj {
}
.stringObj {
}
.customObj {
font-style: italic;
font-size: 10pt;
}
table.listTbl {
border: 0px solid black;
background-color: #F5F798;
border-spacing: 0px;
}
table.listTbl td.listHeader {
padding-left: 5px;
padding-top: 3px;
font-size: 8pt;
color: #666666;
text-align: left;
border-left: 1px solid #555555;
}
table.listTbl td.listElt {
padding-top: 0px;
padding-bottom: 8px;
padding-left: 10px;
padding-right: 10px;
border-bottom: 1px solid #555555; /* must match td.listHeader border */
border-left: 1px solid #555555; /* must match td.listHeader border */
vertical-align: bottom;
}
table.tupleTbl {
border: 1px solid #555555;
background-color: #dddddd; /* must match .frameDataViz background-color */
border-spacing: 0px;
color: black;
}
table.tupleTbl td.tupleHeader {
padding-left: 5px;
padding-top: 3px;
padding-bottom: 0px;
font-size: 8pt;
color: #666666;
text-align: left;
border-left: 1px dotted #555555;
}
table.tupleTbl td.tupleElt {
border-left: 1px dotted #555555; /* must match td.tupleHeader border */
vertical-align: bottom;
padding: 5px;
}
table.setTbl {
border: 1px solid black;
background-color: #F4F776;
border-spacing: 0px;
text-align: center;
}
table.setTbl td.setElt {
padding: 8px;
}
table.dictTbl {
background-color: #899CD1;
border-collapse: collapse;
border-spacing: 2px;
/*margin: 12px;*/
}
table.dictTbl tr.dictEntry {
border: 1px #111111 solid;
}
table.dictTbl td.dictKey {
background-color: #41507A;
color: #ffffff;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 10px;
padding-right: 6px;
text-align: right;
vertical-align: center;
}
table.dictTbl td.dictVal {
background-color: #899CD1; /* must match color of table.dictTbl */
padding-top: 10px;
padding-bottom: 10px;
padding-right: 10px;
padding-left: 6px;
vertical-align: top;
}
table.classTbl {
background-color: #FFFFFF;
border-collapse: collapse;
border-spacing: 2px;
}
table.classTbl tr.classEntry {
border: 1px #777777 solid;
}
table.classTbl td.classKey {
background-color: #222222;
color: #dddddd;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 10px;
padding-right: 6px;
text-align: right;
vertical-align: center;
}
table.classTbl td.classVal {
background-color: #FFFFFF; /* must match color of table.classTbl */
padding-top: 10px;
padding-bottom: 10px;
padding-right: 10px;
padding-left: 6px;
vertical-align: top;
}
table.instTbl {
background-color: #FFFFDD;
border-collapse: collapse;
border-spacing: 2px;
}
table.instTbl tr.instEntry {
border: 1px #111111 solid;
}
table.instTbl td.instKey {
background-color: #41507A;
color: #ffffff;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 10px;
padding-right: 6px;
text-align: right;
vertical-align: center;
}
table.instTbl td.instVal {
background-color: #FFFFDD; /* must match color of table.instTbl */
padding-top: 10px;
padding-bottom: 10px;
padding-right: 10px;
padding-left: 6px;
vertical-align: top;
}
.typeLabel {
font-size: 8pt;
color: #222222;
margin-bottom: 1px;
}
td.dictKey .typeLabel {
color: #eeeeee;
}
.circRefLabel {
font-size: 10pt;
color: #222222;
}
#footer {
text-align: center;
color: #666666;
font-size: 9pt;
max-width: 700px;
border-top: 1px solid #bbbbbb;
padding-top: 5px;
margin-top: 10px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

25
book/common/css/poll.css Normal file
View file

@ -0,0 +1,25 @@
/* Styles for Runestone poll directive */
.poll .poll-question {
padding-bottom: 10px;
}
.poll-options > label {
margin-right: 5px;
}
.poll .progress {
width: 350px;
height: 25px;
margin-top: -20px;
}
.poll .progress .progress-bar {
height: 30px;
color: #333;
}
.poll-text {
line-height: 22px;
display: inline-block;
vertical-align: text-bottom;
}

View file

@ -0,0 +1,380 @@
/* Runestone custom modifications */
body {
padding-top: 60px;
padding-bottom: 40px;
background-color: #eeeeee;
}
pre {
margin: 1em 0;
}
h5 {
font-weight: bold;
padding: 10px 0;
}
/* navbar and menu related styles */
@media (max-width: 768px) {
/* Remove top padding when top navbar goes collapsed in narrow viewports */
body {
padding-top: 0;
margin: auto auto auto 5px;
}
.navbar-fixed-top {
position: static;
}
}
@media (min-width: 768px) {
/* when navbar is collapsed we don't want any vertical dividers taking up space */
.navbar .divider-vertical {
height: 50px;
margin: 0 3px;
border-left: 1px solid #f2f2f2;
}
}
div.container {
background-color: #ffffff;
}
div.section {
max-width: 500pt;
margin-left: auto;
margin-right: auto;
}
.navbar>.container .navbar-brand {
margin-left: 0;
}
.navbar>.container {
background-color: #f8f8f8;
}
.footer>.container {
background-color: #eeeeee;
}
.brand-logo {
float: left;
display: block;
background-size: 40px 40px !important;
width: 40px;
height: 40px;
margin-top: 4px;
}
.social-menu {
width: 220px;
padding: 10px 10px 15px 20px;
}
.fb-like {
margin-top: 7px;
}
.fb_iframe_widget span, .fb_iframe_widget iframe {
height: 20px !important;
width: 82px !important;
}
.twitter-follow-button {
margin-top: 10px;
}
.gittip {
margin-top: 8px;
}
.gittip-button {
margin-bottom: -6px;
}
.dropdown-menu > li > span {
display: block;
padding: 3px 20px;
clear: both;
font-weight: bold;
line-height: 20px;
color: #333;
white-space: nowrap;
}
.loggedinuser {
font-weight: bold;
}
/* end navbar and menu related styles */
.CodeMirror {
margin: 0 0 1em 0;
background-color: #fff;
}
button.btn, btn.btn-sm,
input[type="submit"].btn.btn-sm,
input[type="button"].btn.btn-sm {
font-size: 1em;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.btn {
margin: 5px 0;
}
.btn.disabled {
/* needed in Bootstrap 3 to allow tooltips on disabled buttons */
pointer-events: auto;
}
.btn-default,
.btn-default.disabled,
.btn-default[disabled],
.btn-default.disabled:hover,
.btn-default[disabled]:hover {
color: #fff;
background-color: #474949;
border-color: #474949;
}
.btn-default:hover, .btn-default:focus, .btn-default:active, .btn-default.active {
background-color: #3a3c3c;
border-color: #2e2f2f;
color: #fff;
}
.tooltip {
z-index: 2000 !important;
}
.tooltip.in {
opacity: 0.8;
filter: alpha(opacity=80);
}
h2 {
margin-top: 20px;
}
.alert form {
margin-bottom: 0;
}
/* default bookstrap alert color is hard to read (low contrast). */
.alert {
color: #333;
padding: 10px;
}
/* override the color styles applied by Skulpt to the unittest results divs */
.unittest-results.alert-danger {
background-color: #f2dede !important;
}
.unittest-results.alert-success {
background-color: #dff0d8 !important;
}
.alert label {
font-weight: normal;
}
/* These admonition styles styles are copied from the Bootstrap .alert classes.
Most of the !important declarations are to override the Sphinx basic.css styles */
.admonition {
padding: 8px 35px 8px 14px !important;
margin-bottom: 20px !important;
margin-top: 20px !important;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
background-color: #fcf8e3;
border: 1px solid #fbeed5;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
/* .alert-danger */
.admonition.caution {
color: #b94a48;
background-color: #f2dede;
border-color: #eed3d7;
}
/* .alert-info */
.admonition.tip, .admonition.note {
color: #333;
background-color: #d9edf7;
border-color: #bce8f1;
}
/* from web2py.css */
div.flash {
font-weight: bold;
position: fixed;
padding: 10px;
top: 55px;
right: 45px;
opacity: 0.95;
margin: 0 0 10px 10px;
vertical-align: middle;
cursor: pointer;
color: #fff;
background-color: #000;
border: 2px solid #fff;
border-radius: 8px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
background-image: -webkit-linear-gradient(top, #222, #000);
background-image: -o-linear-gradient(top, #222, #000);
background-image: -moz-linear-gradient(90deg, #222, #000);
background-image: linear-gradient(top, #222, #000);
background-repeat: repeat-x;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
z-index: 2000;
}
/* Styles for the login, registration, and Janrain forms */
#web2py_user_form {
margin-top: 10px;
}
#web2py_user_form form {
float: left;
margin-right: 150px;
padding-top: 3px;
}
#web2py_user_form td {
padding-bottom: 15px;
}
#web2py_user_form td.w2p_fw {
width: 299px;
}
#auth-actions {
margin-top: 50px;
}
#sign_in_text td {
font-size: 17px;
color: #333;
font-family: 'lucida grande', Verdana, sans-serif;
padding-bottom: 13px;
}
#auth_user_remember {
margin-top: -20px;
}
/* End login, registration, Janrain styles */
/* end-of-chapter exercises styles */
#exercises > ol > li,
#programming-exercises > ol > li {
margin-bottom: 30px;
}
#exercises > ol > li:nth-child(even),
#programming-exercises > ol > li:nth-child(even) {
padding: 1.2em 1.4em;
background: #faf7df;
border: 1px solid #fbeed5;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
/* End chapter exercises styles */
/* Modal dialog styles (scratch activecode, compare me, etc) */
.scratch-ac-modal {
width: 800px;
}
.compare-modal .progress {
margin-bottom: 0;
}
.compare-me-progress {
width: 100%;
}
.compare-me-progress .progress-bar,
.unittest-results-progress .progress-bar {
color: #333;
}
.unittest-results-progress {
width: 25%;
}
.compare-modal {
width: 350px;
}
.compare-modal table {
border-collapse: separate;
border-spacing: 10px 5px;
}
.codelens-modal {
/* we set some custom position styles so that the modal doesn't obscure the codelens visualizer */
top: 20%;
right: 20%;
left: auto;
bottom: auto;
}
@media (max-width: 768px) {
/* remove any custom position styles when the screen is small (mobile devices)
to prevent the modal from being partially off the screen */
.codelens-modal {
top: 0 !important;
right: 0 !important;
bottom: 0 !important;
left: 0 !important;
}
}
.codelens-modal > .modal-dialog {
width: 400px;
}
/* End modal dialog styles */
.footnote.table {
width: auto;
margin-bottom: 10px;
}
.footnote.table td.label {
padding: 2px 5px 2px 5px;
background-color: #d9edf7;
}
.ac-canvas {
background-color: white;
}
.video-play-overlay {
position: absolute;
top: -35px;
left: 30%;
height: 85px;
width: 130px;
background-position: center;
background-repeat: no-repeat;
}
.ui-sortable-helper {
height: auto !important;
width: auto !important;
}
.activehtml {
width: 500px;
height: 400px;
}

350
book/common/css/style.css Normal file
View file

@ -0,0 +1,350 @@
/**
* Sphinx stylesheet -- sphinxdoc theme
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
'Verdana', sans-serif;
font-size: 14px;
letter-spacing: -0.01em;
line-height: 150%;
text-align: center;
background-image: url(bg01.jpg);
color: black;
padding: 0;
border: 1px solid #aaa;
margin: 0px 80px 0px 80px;
min-width: 740px;
}
div.documentwrapper {
float: none;
border: 1px solid #0aa;
}
div.document {
background-color: white;
text-align: left;
background-image: url(contents.png);
background-repeat: repeat-x;
min-height: 550px;
}
div.bodywrapper {
margin: 0 240px 0 0;
border-right: 1px solid #ccc;
}
div.body {
margin: 0;
padding: 0.5em 20px 20px 20px;
}
div.related {
font-size: 1em;
}
div.related ul {
background-color: rgb(49,94,97);
height: 2em;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
}
div.related ul li {
margin: 0;
padding: 0;
height: 2em;
float: left;
}
div.related ul li.right {
float: right;
margin-right: 5px;
}
div.related ul li a {
margin: 0;
padding: 0 5px 0 5px;
line-height: 1.75em;
/*color: rgb(75,136,141); */
color: #ffffff;
}
div.related ul li a:hover {
color: #3CA8E7;
}
div.sphinxsidebarwrapper {
padding: 0;
position: fixed;
width: 220px;
height: 90%;
overflow-y: auto;
overflow-x: visible;
top: 25px;
bottom: 0;
}
div.sphinxsidebar {
margin: 0;
padding: 0.5em 15px 15px 0;
width: 220px;
float: right;
font-size: 1em;
text-align: left;
}
div.sphinxsidebar a:hover {
background-color: #d0d0d0;
}
div.sphinxsidebar h3, div.sphinxsidebar h4 {
margin: 1em 0 0.5em 0;
font-size: 1em;
padding: 0.1em 0 0.1em 0.5em;
color: white;
border: 1px solid #86989B;
background-color: #AFC1C4;
}
div.sphinxsidebar h3 a {
color: white;
}
div.sphinxsidebar ul {
padding-left: 1.5em;
margin-top: 7px;
padding: 0;
line-height: 130%;
}
div.sphinxsidebar ul ul {
margin-left: 20px;
}
div.footer {
background-color: rgb(49,94,97);
color: #ffffff;
padding: 3px 8px 3px 0;
clear: both;
font-size: 0.8em;
text-align: right;
}
div.footer a {
color: #86989B;
text-decoration: underline;
}
/* -- body styles ----------------------------------------------------------- */
p {
margin: 0.8em 0 0.5em 0;
}
a {
color: rgb(75,136,141);
text-decoration: none;
}
a:hover {
color: #2491CF;
}
div.body a {
text-decoration: underline;
}
h1 {
margin: 0;
padding: 0.7em 0 0.3em 0;
font-size: 1.5em;
color: #11557C;
}
h2 {
margin: 1.3em 0 0.2em 0;
font-size: 1.35em;
padding: 0;
}
h3 {
margin: 1em 0 -0.3em 0;
font-size: 1.2em;
}
div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
color: black!important;
}
h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
display: none;
margin: 0 0 0 0.3em;
padding: 0 0.2em 0 0.2em;
color: #aaa!important;
}
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
h5:hover a.anchor, h6:hover a.anchor {
display: inline;
}
h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
h5 a.anchor:hover, h6 a.anchor:hover {
color: #777;
background-color: #eee;
}
a.headerlink {
color: #c60f0f!important;
font-size: 1em;
margin-left: 6px;
padding: 0 4px 0 4px;
text-decoration: none!important;
}
a.headerlink:hover {
background-color: #ccc;
color: white!important;
}
cite, code, tt {
font-family: 'Consolas', 'Deja Vu Sans Mono',
'Bitstream Vera Sans Mono', monospace;
font-size: 0.95em;
letter-spacing: 0.01em;
}
tt {
background-color: #f2f2f2;
border-bottom: 1px solid #ddd;
color: #333;
}
tt.descname, tt.descclassname, tt.xref {
border: 0;
}
hr {
border: 1px solid #abc;
margin: 2em;
}
a tt {
border: 0;
color: rgb(75,136,141);
}
a tt:hover {
color: #2491CF;
}
pre {
font-family: 'Consolas', 'Deja Vu Sans Mono',
'Bitstream Vera Sans Mono', monospace;
font-size: 0.95em;
letter-spacing: 0.015em;
line-height: 120%;
padding: 0.5em;
border: 1px solid #ccc;
background-color: #f8f8f8;
}
pre a {
color: inherit;
text-decoration: underline;
}
td.linenos pre {
padding: 0.5em 0;
}
div.quotebar {
background-color: #f8f8f8;
max-width: 250px;
float: right;
padding: 2px 7px;
border: 1px solid #ccc;
}
div.topic {
background-color: #f8f8f8;
}
table {
border-collapse: collapse;
margin: 0 -0.5em 0 -0.5em;
}
table td, table th {
padding: 0.2em 0.5em 0.2em 0.5em;
}
div.admonition, div.warning {
font-size: 0.9em;
margin: 1em 0 1em 0;
border: 1px solid #86989B;
background-color: #f7f7f7;
padding: 0;
}
div.admonition p, div.warning p {
margin: 0.5em 1em 0.5em 1em;
padding: 0;
}
div.admonition pre, div.warning pre {
margin: 0.4em 1em 0.4em 1em;
}
div.admonition p.admonition-title,
div.warning p.admonition-title {
margin: 0;
padding: 0.1em 0 0.1em 0.5em;
color: white;
border-bottom: 1px solid #86989B;
font-weight: bold;
background-color: #AFC1C4;
}
div.warning {
border: 1px solid #940000;
}
div.warning p.admonition-title {
background-color: #CF0000;
border-bottom-color: #940000;
}
div.admonition ul, div.admonition ol,
div.warning ul, div.warning ol {
margin: 0.1em 0.5em 0.5em 3em;
padding: 0;
}
div.versioninfo {
margin: 1em 0 0 0;
border: 1px solid #ccc;
background-color: #DDEAF0;
padding: 8px;
line-height: 1.3em;
font-size: 0.9em;
}
div.error {
background-color: #F4F4AD;
}
.correct {
color: #84b8d9;
}

View file

@ -0,0 +1,32 @@
/* Styles for the Runestone tabbed exhibit directive */
.tab-pane {
padding: 20px 15px 10px 15px;
}
.nav.nav-tabs {
padding-top: 6px;
background-color: #CFCCB8;
border-color: #fbeed5;
border-radius: 4px;
}
.nav.nav-tabs li {
margin-right: 1px;
margin-left: 6px;
}
.nav.nav-tabs li > a {
background-color: #E6E2CC;
border-bottom-color: #fcf8e3;
color: #555;
}
.nav-tabs > li > a:hover {
border-color: #b4b19d;
border-bottom-width:0;
}
.nav.nav-tabs li.active > a {
background-color: #faf7df;
}

View file

@ -0,0 +1,65 @@
.my-highlighted-text{
background-color:#FFFF99;
}
.social-highlighted-text{
background-color:#FFCCCC;
}
.highlight-option-box{
position:absolute;
top:0px;
left:0px;
}
.highlight-option-box li{
height:24px;
}
.dropdown-menu{
background-clip: padding-box;
background-color: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 5px 5px 5px 5px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
display: none;
float: left;
left: 0;
list-style: none outside none;
margin: 1px 0 0;
min-width: 160px;
padding: 4px 0;
position: absolute;
top: 100%;
z-index: 1000;
}
.dropdown-menu ul {
list-style: disc outside none;
margin: 0 0 9px 25px;
padding: 0;
}
.sidebar-highlights{
background-color:#FFFF99;
}
div.documentwrapper {
border : 0 none;
}
div.bodywrapper {
border-right: 0 none;
}
div.sphinxsidebar {
border-left: 1px solid #CCCCCC;
padding-left: 10px;
}
.body>.section .section{
padding-top: 1px;
}
#jump-to-chapter{
border: 1px solid #CCCCCC;
letter-spacing: 0.015em;
line-height: 120%;
padding: 0.5em;
}
#navigation-links{
background-color: #F8F8F8;
border: 1px solid #CCCCCC;
padding:10px;
margin:10px;
}

51
book/common/css/video.css Normal file
View file

@ -0,0 +1,51 @@
.exercises {
background-color:#f0ffff;
}
.active_out {
background-color:#dcdcdc;
border-radius: 6px;
}
figcaption {
margin: .75em 0;
text-align: center;
font: italic 13px/18px Cambria, Georgia, "Times New Roman", Times, serif;
}
img.bookfig {
margin-left: auto;
margin-right: auto;
}
.video_popup {
display: none;
}
.ac_caption {
text-align: center;
font-weight: bold;
}
.ac_caption_text {
font-weight: normal;
}
.cl_caption {
text-align: center;
font-weight: bold;
}
.ac_caption:before {
content: "ActiveCode: " counter(activecode) " ";
counter-increment: activecode;
}
.cl_caption:before {
content: "CodeLens: " counter(codelens) " ";
counter-increment: codelens;
}
body {
counter-reset: activecode codelens;
}

View file

@ -0,0 +1,61 @@
/*
* SimpleModal Basic Modal Dialog
* http://www.ericmmartin.com/projects/simplemodal/
* http://code.google.com/p/simplemodal/
*
* Copyright (c) 2010 Eric Martin - http://ericmmartin.com
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Revision: $Id: basic.css 257 2010-07-27 23:06:56Z emartin24 $
*/
.basic-modal-content {display:none;}
/* Overlay */
#simplemodal-overlay {background-color:#000; cursor:wait;}
/* Container */
.simplemodal-container {
height:200px;
width:300px;
color:#bbb;
background-color:#333;
border:4px solid #444;
padding:5px;
}
.simplemodal-container .simplemodal-data {padding:8px;}
.simplemodal-container code {
background:#141414;
border-left:3px solid #65B43D;
color:#bbb;
display:block;
font-size:12px;
margin-bottom:12px;
padding:4px 6px 6px;
}
.simplemodal-container a {color:#ddd;}
.simplemodal-container a.modalCloseImg {
background:url(x.png) no-repeat;
width:25px;
height:29px;
display:inline;
z-index:3200;
position:absolute;
top:-15px;
right:-16px;
cursor:pointer;}
.simplemodal-container h3 {
color:#84b8d9;
text-align: center;
}
.feedbacktext {
color:#84b8d9;
}

View file

@ -0,0 +1,173 @@
.CodeMirror {
line-height: 1.2em; /* pgbovine - enables underscore (_) characters to render properly */
font-family: monospace;
/* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
position: relative;
/* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
overflow: hidden;
}
.CodeMirror-scroll {
overflow: auto;
height: 300px;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
outline: none;
}
/* Vertical scrollbar */
.CodeMirror-scrollbar {
position: absolute;
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
z-index: 5;
}
.CodeMirror-scrollbar-inner {
/* This needs to have a nonzero width in order for the scrollbar to appear
in Firefox and IE9. */
width: 1px;
}
.CodeMirror-scrollbar.cm-sb-overlap {
/* Ensure that the scrollbar appears in Lion, and that it overlaps the content
rather than sitting to the right of it. */
position: absolute;
z-index: 1;
float: none;
right: 0;
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-nonoverlap {
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-ie7 {
min-width: 18px;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
cursor: default;
}
.CodeMirror-lines {
padding: .4em;
white-space: pre;
cursor: text;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
outline: none !important;
}
.CodeMirror pre.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black;
border-right: none;
width: 0;
}
.cm-keymap-fat-cursor pre.CodeMirror-cursor {
width: auto;
border: 0;
background: transparent;
background: rgba(0, 200, 0, .4);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
}
/* Kludge to turn off filter in ie9+, which also accepts rgba */
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
.CodeMirror-focused pre.CodeMirror-cursor {
visibility: visible;
}
div.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* Default theme */
.cm-s-default span.cm-keyword {color: #708;}
.cm-s-default span.cm-atom {color: #219;}
.cm-s-default span.cm-number {color: #164;}
.cm-s-default span.cm-def {color: #00f;}
.cm-s-default span.cm-variable {color: black;}
.cm-s-default span.cm-variable-2 {color: #05a;}
.cm-s-default span.cm-variable-3 {color: #085;}
.cm-s-default span.cm-property {color: black;}
.cm-s-default span.cm-operator {color: black;}
.cm-s-default span.cm-comment {color: #a50;}
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #cc7;}
.cm-s-default span.cm-tag {color: #170;}
.cm-s-default span.cm-attribute {color: #00c;}
.cm-s-default span.cm-header {color: blue;}
.cm-s-default span.cm-quote {color: #090;}
.cm-s-default span.cm-hr {color: #999;}
.cm-s-default span.cm-link {color: #00c;}
span.cm-header, span.cm-strong {font-weight: bold;}
span.cm-em {font-style: italic;}
span.cm-emstrong {font-style: italic; font-weight: bold;}
span.cm-link {text-decoration: underline;}
span.cm-invalidchar {color: #f00;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
@media print {
/* Hide the cursor when printing */
.CodeMirror pre.CodeMirror-cursor {
visibility: hidden;
}
}

View file

@ -0,0 +1,201 @@
/* CSS accompanying ../index.html */
body {
background-color: white;
font-family: Georgia, Palatino, Times, serif;
font-size: 12pt;
/* use fixed width for simplicity */
max-width: 900px;
min-width: 900px;
width: 900px;
margin-left: auto;
margin-right: auto;
}
/* for prose text only */
p, li {
line-height: 1.5;
}
h1 {
font-weight: normal;
margin-top: 0px;
margin-bottom: 8px;
line-height: 1.5;
}
.smallH1 {
font-size: 14pt;
margin-left: -2px;
}
#optLink {
font-size: 14pt;
text-decoration: none;
color: #3D58A2;
font-weight: bold;
}
#optLink:hover {
color: #3D58A2;
text-decoration: underline;
}
.titlePane {
margin-left: auto;
margin-right: auto;
margin-bottom: 0px;
text-align: center;
}
.titlePane h1 {
font-size: 22pt;
margin-bottom: 5px;
}
div.mainBodyPane {
margin-left: auto;
margin-right: auto;
}
div.activityPane {
/* TOP RIGHT BOTTOM LEFT */
padding: 15px 0px /* make right padding ZERO and just right-pad 'p' */ 5px 20px;
text-align: left;
border: 3px solid #005583;
}
div.activityPane p {
padding-right: 30px;
}
div.activityPane h1 {
font-size: 22pt;
margin-bottom: 20pt;
}
ul {
padding-left: 18px;
}
li {
margin-bottom: 12px;
font-size: 10pt;
}
a,
a:visited,
a:hover {
color: #3D58A2;
}
#learnHeading, #embedHeading, #shareHeading {
font-family: verdana, arial, helvetica, sans-serif;
font-weight: bold;
font-size: 24pt;
}
#learnHeading {
color: #062270;
}
div#learnPane {
margin-top: 6pt;
margin-bottom: 8pt;
border: 5px solid #062270;
}
div#learnPane p {
padding-right: 100px;
}
div#learnPane #startLink {
font-size: 17pt;
font-weight: normal;
margin-top: 25px;
margin-bottom: 20px;
font-family: verdana, arial, helvetica, sans-serif;
}
div#learnPane #startLink a {
border-bottom-style: solid;
border-bottom-width: 2px;
text-decoration: none;
}
tt {
/*font-size: 85%;*/
}
div#embedPane {
margin-right: 5px;
border: 5px solid #5a7973;
}
#embedHeading {
color: #5a7973;
}
div#sharePane {
margin-left: 5px;
border: 5px solid #4284d3;
}
#shareHeading {
color: #4284d3;
}
div#detailsPane {
margin-top: 0px;
margin-left: 5px;
border: 0px; /* NO BORDER! */
}
#partnershipDiv {
/*background-color: #d8e1e3;*/
background-color: #d9cdb6;
width: 60%;
padding: 8px;
margin-left: auto;
margin-right: auto;
text-align: center;
font-size: 10pt;
font-family: Monaco, arial, sans-serif;
}
table.layoutTbl {
border: 0px;
max-width: 900px;
}
table.layoutTbl td#embedPaneTd {
width: 60%;
vertical-align: top;
}
table.layoutTbl td#sharePaneTd {
width: 40%;
vertical-align: top;
}
#footer {
color: #666666;
font-size: 9pt;
border-top: 1px solid #bbbbbb;
padding-top: 0px;
margin-top: 20px;
/* center align */
margin-left: auto;
margin-right: auto;
font-family: verdana, arial, helvetica, sans-serif;
}

View file

@ -0,0 +1,573 @@
/*! qTip2 - Pretty powerful tooltips - v2.0.0 - 2012-09-10
* http://craigsworks.com/projects/qtip2/
* Copyright (c) 2012 Craig Michael Thompson; Licensed MIT, GPL */
/* Fluid class for determining actual width in IE */
#qtip-rcontainer{
position: absolute;
left: -28000px;
top: -28000px;
display: block;
visibility: hidden;
}
/* Fluid class for determining actual width in IE */
#qtip-rcontainer .ui-tooltip{
display: block !important;
visibility: hidden !important;
position: static !important;
float: left !important;
}
/* Core qTip styles */
.ui-tooltip, .qtip{
position: absolute;
left: -28000px;
top: -28000px;
display: none;
max-width: 280px;
min-width: 50px;
font-size: 10.5px;
line-height: 12px;
}
.ui-tooltip-content{
position: relative;
padding: 5px 9px;
overflow: hidden;
text-align: left;
word-wrap: break-word;
}
.ui-tooltip-titlebar{
position: relative;
min-height: 14px;
padding: 5px 35px 5px 10px;
overflow: hidden;
border-width: 0 0 1px;
font-weight: bold;
}
.ui-tooltip-titlebar + .ui-tooltip-content{ border-top-width: 0 !important; }
/* Default close button class */
.ui-tooltip-titlebar .ui-state-default{
position: absolute;
right: 4px;
top: 50%;
margin-top: -9px;
cursor: pointer;
outline: medium none;
border-width: 1px;
border-style: solid;
}
* html .ui-tooltip-titlebar .ui-state-default{ top: 16px; } /* IE fix */
.ui-tooltip-titlebar .ui-icon,
.ui-tooltip-icon .ui-icon{
display: block;
text-indent: -1000em;
direction: ltr;
}
.ui-tooltip-icon, .ui-tooltip-icon .ui-icon{
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
text-decoration: none;
}
.ui-tooltip-icon .ui-icon{
width: 18px;
height: 14px;
text-align: center;
text-indent: 0;
font: normal bold 10px/13px Tahoma,sans-serif;
color: inherit;
background: transparent none no-repeat -100em -100em;
}
/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */
.ui-tooltip-focus{}
/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */
.ui-tooltip-hover{}
/* Default tooltip style */
.ui-tooltip-default{
border-width: 1px;
border-style: solid;
border-color: #F1D031;
background-color: #FFFFA3;
color: #555;
}
.ui-tooltip-default .ui-tooltip-titlebar{
background-color: #FFEF93;
}
.ui-tooltip-default .ui-tooltip-icon{
border-color: #CCC;
background: #F1F1F1;
color: #777;
}
.ui-tooltip-default .ui-tooltip-titlebar .ui-state-hover{
border-color: #AAA;
color: #111;
}
/*! Light tooltip style */
.ui-tooltip-light{
background-color: white;
border-color: #E2E2E2;
color: #454545;
}
.ui-tooltip-light .ui-tooltip-titlebar{
background-color: #f1f1f1;
}
/*! Dark tooltip style */
.ui-tooltip-dark{
background-color: #505050;
border-color: #303030;
color: #f3f3f3;
}
.ui-tooltip-dark .ui-tooltip-titlebar{
background-color: #404040;
}
.ui-tooltip-dark .ui-tooltip-icon{
border-color: #444;
}
.ui-tooltip-dark .ui-tooltip-titlebar .ui-state-hover{
border-color: #303030;
}
/*! Cream tooltip style */
.ui-tooltip-cream{
background-color: #FBF7AA;
border-color: #F9E98E;
color: #A27D35;
}
.ui-tooltip-cream .ui-tooltip-titlebar{
background-color: #F0DE7D;
}
.ui-tooltip-cream .ui-state-default .ui-tooltip-icon{
background-position: -82px 0;
}
/*! Red tooltip style */
.ui-tooltip-red{
background-color: #F78B83;
border-color: #D95252;
color: #912323;
}
.ui-tooltip-red .ui-tooltip-titlebar{
background-color: #F06D65;
}
.ui-tooltip-red .ui-state-default .ui-tooltip-icon{
background-position: -102px 0;
}
.ui-tooltip-red .ui-tooltip-icon{
border-color: #D95252;
}
.ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{
border-color: #D95252;
}
/*! Green tooltip style */
.ui-tooltip-green{
background-color: #CAED9E;
border-color: #90D93F;
color: #3F6219;
}
.ui-tooltip-green .ui-tooltip-titlebar{
background-color: #B0DE78;
}
.ui-tooltip-green .ui-state-default .ui-tooltip-icon{
background-position: -42px 0;
}
/*! Blue tooltip style */
.ui-tooltip-blue{
background-color: #E5F6FE;
border-color: #ADD9ED;
color: #5E99BD;
}
.ui-tooltip-blue .ui-tooltip-titlebar{
background-color: #D0E9F5;
}
.ui-tooltip-blue .ui-state-default .ui-tooltip-icon{
background-position: -2px 0;
}
/* Add shadows to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
.ui-tooltip-shadow{
-webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15);
}
/* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
.ui-tooltip-rounded,
.ui-tooltip-tipsy,
.ui-tooltip-bootstrap{
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
/* Youtube tooltip style */
.ui-tooltip-youtube{
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0 0 3px #333;
-moz-box-shadow: 0 0 3px #333;
box-shadow: 0 0 3px #333;
color: white;
border-width: 0;
background: #4A4A4A;
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,black));
background-image: -webkit-linear-gradient(top,#4A4A4A 0,black 100%);
background-image: -moz-linear-gradient(top,#4A4A4A 0,black 100%);
background-image: -ms-linear-gradient(top,#4A4A4A 0,black 100%);
background-image: -o-linear-gradient(top,#4A4A4A 0,black 100%);
}
.ui-tooltip-youtube .ui-tooltip-titlebar{
background-color: #4A4A4A;
background-color: rgba(0,0,0,0);
}
.ui-tooltip-youtube .ui-tooltip-content{
padding: .75em;
font: 12px arial,sans-serif;
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);
-ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);";
}
.ui-tooltip-youtube .ui-tooltip-icon{
border-color: #222;
}
.ui-tooltip-youtube .ui-tooltip-titlebar .ui-state-hover{
border-color: #303030;
}
/* jQuery TOOLS Tooltip style */
.ui-tooltip-jtools{
background: #232323;
background: rgba(0, 0, 0, 0.7);
background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323));
background-image: -moz-linear-gradient(top, #717171, #232323);
background-image: -webkit-linear-gradient(top, #717171, #232323);
background-image: -ms-linear-gradient(top, #717171, #232323);
background-image: -o-linear-gradient(top, #717171, #232323);
border: 2px solid #ddd;
border: 2px solid rgba(241,241,241,1);
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0 0 12px #333;
-moz-box-shadow: 0 0 12px #333;
box-shadow: 0 0 12px #333;
}
/* IE Specific */
.ui-tooltip-jtools .ui-tooltip-titlebar{
background-color: transparent;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";
}
.ui-tooltip-jtools .ui-tooltip-content{
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";
}
.ui-tooltip-jtools .ui-tooltip-titlebar,
.ui-tooltip-jtools .ui-tooltip-content{
background: transparent;
color: white;
border: 0 dashed transparent;
}
.ui-tooltip-jtools .ui-tooltip-icon{
border-color: #555;
}
.ui-tooltip-jtools .ui-tooltip-titlebar .ui-state-hover{
border-color: #333;
}
/* Cluetip style */
.ui-tooltip-cluetip{
-webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4);
background-color: #D9D9C2;
color: #111;
border: 0 dashed transparent;
}
.ui-tooltip-cluetip .ui-tooltip-titlebar{
background-color: #87876A;
color: white;
border: 0 dashed transparent;
}
.ui-tooltip-cluetip .ui-tooltip-icon{
border-color: #808064;
}
.ui-tooltip-cluetip .ui-tooltip-titlebar .ui-state-hover{
border-color: #696952;
color: #696952;
}
/* Tipsy style */
.ui-tooltip-tipsy{
background: black;
background: rgba(0, 0, 0, .87);
color: white;
border: 0 solid transparent;
font-size: 11px;
font-family: 'Lucida Grande', sans-serif;
font-weight: bold;
line-height: 16px;
text-shadow: 0 1px black;
}
.ui-tooltip-tipsy .ui-tooltip-titlebar{
padding: 6px 35px 0 10;
background-color: transparent;
}
.ui-tooltip-tipsy .ui-tooltip-content{
padding: 6px 10;
}
.ui-tooltip-tipsy .ui-tooltip-icon{
border-color: #222;
text-shadow: none;
}
.ui-tooltip-tipsy .ui-tooltip-titlebar .ui-state-hover{
border-color: #303030;
}
/* Tipped style */
.ui-tooltip-tipped{
border: 3px solid #959FA9;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color: #F9F9F9;
color: #454545;
font-weight: normal;
font-family: serif;
}
.ui-tooltip-tipped .ui-tooltip-titlebar{
border-bottom-width: 0;
color: white;
background: #3A79B8;
background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D));
background-image: -webkit-linear-gradient(top, #3A79B8, #2E629D);
background-image: -moz-linear-gradient(top, #3A79B8, #2E629D);
background-image: -ms-linear-gradient(top, #3A79B8, #2E629D);
background-image: -o-linear-gradient(top, #3A79B8, #2E629D);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";
}
.ui-tooltip-tipped .ui-tooltip-icon{
border: 2px solid #285589;
background: #285589;
}
.ui-tooltip-tipped .ui-tooltip-icon .ui-icon{
background-color: #FBFBFB;
color: #555;
}
/**
* Twitter Bootstrap style.
*
* Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11.
* Does not work with IE 7.
*/
.ui-tooltip-bootstrap{
font-size: 13px;
line-height: 18px;
color: #333333;
background-color: #ffffff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
*border-right-width: 2px;
*border-bottom-width: 2px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
.ui-tooltip-bootstrap .ui-tooltip-titlebar{
font-size: 18px;
line-height: 22px;
border-bottom: 1px solid #ccc;
background-color: transparent;
}
.ui-tooltip-bootstrap .ui-tooltip-titlebar .ui-state-default{
right: 9px; top: 49%;
border-style: none;
}
.ui-tooltip-bootstrap .ui-tooltip-icon{
background: white;
}
.ui-tooltip-bootstrap .ui-tooltip-icon .ui-icon{
width: auto;
height: auto;
float: right;
font-size: 20px;
font-weight: bold;
line-height: 18px;
color: #000000;
text-shadow: 0 1px 0 #ffffff;
opacity: 0.2;
filter: alpha(opacity=20);
}
.ui-tooltip-bootstrap .ui-tooltip-icon .ui-icon:hover{
color: #000000;
text-decoration: none;
cursor: pointer;
opacity: 0.4;
filter: alpha(opacity=40);
}
/* IE9 fix - removes all filters */
.ui-tooltip:not(.ie9haxors) div.ui-tooltip-content,
.ui-tooltip:not(.ie9haxors) div.ui-tooltip-titlebar{
filter: none;
-ms-filter: none;
}
/* Tips plugin */
.ui-tooltip .ui-tooltip-tip{
margin: 0 auto;
overflow: hidden;
z-index: 10;
}
.ui-tooltip .ui-tooltip-tip,
.ui-tooltip .ui-tooltip-tip .qtip-vml{
position: absolute;
line-height: 0.1px !important;
font-size: 0.1px !important;
color: #123456;
background: transparent;
border: 0 dashed transparent;
}
.ui-tooltip .ui-tooltip-tip canvas{ top: 0; left: 0; }
.ui-tooltip .ui-tooltip-tip .qtip-vml{
behavior: url(#default#VML);
display: inline-block;
visibility: visible;
}
/* Modal plugin */
#qtip-overlay{
position: fixed;
left: -10000em;
top: -10000em;
}
/* Applied to modals with show.modal.blur set to true */
#qtip-overlay.blurs{ cursor: pointer; }
/* Change opacity of overlay here */
#qtip-overlay div{
position: absolute;
left: 0; top: 0;
width: 100%; height: 100%;
background-color: black;
opacity: 0.7;
filter:alpha(opacity=70);
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
}

View file

@ -0,0 +1,86 @@
/* CSS accompanying ../visualize.html */
h1 {
font-weight: normal;
font-size: 20pt;
font-family: georgia, serif;
line-height: 1em; /* enforce single spacing so that Georgia works */
margin-top: 0px;
margin-bottom: 8px;
}
h2 {
font-size: 12pt;
font-weight: normal;
font-family: georgia, serif;
line-height: 1.1em; /* enforce single spacing so that Georgia works */
margin-top: 2px;
margin-bottom: 20px;
}
body {
background-color: white;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 10pt;
}
a,
a:visited,
a:hover {
color: #3D58A2;
}
span {
padding: 0px;
}
table#pyOutputPane {
padding: 10px;
}
#pyInputPane {
margin-top: 20px;
margin-bottom: 20px;
max-width: 700px;
/* center align */
margin-left: auto;
margin-right: auto;
}
#codeInputPane {
margin-top: 5px;
font-size: 12pt;
border: 1px solid #ddd;
}
button.smallBtn {
font-size: 10pt;
padding: 3px;
}
button.bigBtn {
font-size: 13pt;
padding: 6px;
margin-top: 6px;
}
#footer {
color: #666666;
font-size: 9pt;
border-top: 1px solid #bbbbbb;
padding-top: 5px;
margin-top: 5px;
max-width: 700px;
/* center align */
margin-left: auto;
margin-right: auto;
}
/* necessary for CodeMirror error line highlighting to work! */
.CodeMirror .errorLine { background: #ffff3f !important; }

View file

@ -0,0 +1,85 @@
/* CSS accompanying ../lesson.html */
body {
background-color: white;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 10pt;
max-width: 900px;
/* center align */
margin-left: auto;
margin-right: auto;
}
div#lessonHeader {
margin-bottom: 15pt;
width: 800px;
}
div#lessonTitle {
font-size: 16pt;
margin-bottom: 15pt;
}
div#lessonDescription {
font-size: 11pt;
line-height: 1.5em;
}
div#lessonNarration {
font-size: 11pt;
min-height: 25px;
margin-bottom: 12px;
line-height: 1.5em;
width: 800px;
}
a,
a:visited,
a:hover {
color: #3D58A2;
}
span {
padding: 0px;
}
table#pyOutputPane {
padding: 10px;
}
#pyInputPane {
margin-top: 20px;
margin-bottom: 20px;
max-width: 700px;
/* center align */
margin-left: auto;
margin-right: auto;
}
#codeInputPane {
margin-top: 5px;
font-size: 12pt;
}
button.smallBtn {
font-size: 10pt;
padding: 3px;
}
button.bigBtn {
font-size: 12pt;
padding: 5px;
}
#footer {
color: #666;
font-size: 9pt;
border-top: 1px solid #bbb;
padding-top: 12px;
margin-top: 5px;
}

View file

@ -0,0 +1,749 @@
/*
Online Python Tutor
https://github.com/pgbovine/OnlinePythonTutor/
Copyright (C) 2010-2012 Philip J. Guo (philip@pgbovine.net)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Most recent color scheme redesign on 2012-08-19 */
/* To prevent CSS namespace clashes, prefix all rules with:
div.ExecutionVisualizer
*/
/* reset some styles to nullify effects of existing stylesheets
e.g., http://meyerweb.com/eric/tools/css/reset/
*/
div.ExecutionVisualizer {
/* none for now */
}
div.ExecutionVisualizer table.visualizer {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 10pt;
margin-bottom: 10px;
}
div.ExecutionVisualizer table.visualizer td.vizLayoutTd {
vertical-align: top;
}
div.ExecutionVisualizer td#stack_td,
div.ExecutionVisualizer td#heap_td {
vertical-align:top;
font-size: 10pt; /* don't make fonts in the heap so big! */
}
div.ExecutionVisualizer #dataViz {
margin-left: 25px;
}
div.ExecutionVisualizer div#codeDisplayDiv {
/* set this as default unless user specifies a custom size */
width: 550px;
}
div.ExecutionVisualizer div#pyCodeOutputDiv {
/*max-width: 550px;*/
max-height: 450px;
/*max-height: 620px;*/
overflow: auto;
/*margin-bottom: 4px;*/
margin-left: auto;
margin-right: auto;
}
div.ExecutionVisualizer table#pyCodeOutput {
font-family: Andale mono, monospace;
font-size:12pt;
line-height:1.1em;
border-collapse: separate; /* some crazy CSS voodoo that needs to be
there so that SVG arrows to the left
of the code line up vertically in Chrome */
border-spacing: 0px;
border-top: 1px solid #bbb;
padding-top: 3px;
border-bottom: 1px solid #bbb;
/*margin-top: 6px;*/
margin: 6px auto; /* Center code in its pane */
}
/* don't wrap lines within code output ... FORCE scrollbars to appear */
div.ExecutionVisualizer table#pyCodeOutput td {
white-space: nowrap;
vertical-align: middle; /* explicitly force, to override external CSS conflicts */
}
div.ExecutionVisualizer #leftCodeGutterSVG {
width: 18px;
height: 0px; /* programmatically set this later ... IE needs this to
be 0 or it defaults to something arbitrary and gross */
}
div.ExecutionVisualizer #prevLegendArrowSVG,
div.ExecutionVisualizer #curLegendArrowSVG {
width: 18px;
height: 10px;
}
div.ExecutionVisualizer .arrow {
font-size: 16pt;
}
div.ExecutionVisualizer table#pyCodeOutput .lineNo {
color: #aaa;
padding: 0.2em;
padding-left: 0.3em;
padding-right: 0.5em;
text-align: right;
}
div.ExecutionVisualizer table#pyCodeOutput .cod {
/*font-weight: bold;*/
margin-left: 3px;
padding-left: 7px;
text-align: left; /* necessary or else doesn't work properly in IE */
}
div.ExecutionVisualizer div#progOutputs {
margin-top: 8px;
}
div.ExecutionVisualizer div#legendDiv {
margin-top: 10px;
padding: 0px;
text-align: left;
color: #666;
font-size: 9pt;
}
div.ExecutionVisualizer div#editCodeLinkDiv {
text-align: center;
/*
margin-top: 12px;
margin-bottom: 4px;
*/
margin: 8px auto;
}
div.ExecutionVisualizer div#annotateLinkDiv {
/*text-align: left;*/
margin-top: 0px;
margin-bottom: 12px;
/*
margin-left: auto;
margin-right: auto;
*/
}
div.ExecutionVisualizer div#stepAnnotationDiv {
margin-bottom: 12px;
}
div.ExecutionVisualizer textarea#stepAnnotationEditor,
div.ExecutionVisualizer textarea#vizTitleEditor,
div.ExecutionVisualizer textarea#vizDescriptionEditor {
border: 1px solid #999999;
padding: 4px;
overflow: auto; /* to look pretty on IE */
/* make sure textarea doesn't grow and stretch */
resize: none;
}
div.ExecutionVisualizer #errorOutput {
color: #e93f34; /* should match brightRed JavaScript variable */
font-size: 12pt;
padding: 2px;
line-height: 1.5em;
margin-bottom: 4px;
}
/* VCR control buttons for stepping through execution */
div.ExecutionVisualizer #vcrControls {
margin: 15px auto;
/*width: 100%;*/
text-align: center;
}
div.ExecutionVisualizer #vcrControls button {
margin-left: 2px;
margin-right: 2px;
}
div.ExecutionVisualizer #vcrControls #curInstr {
margin-left: 4px;
margin-right: 4px;
}
div.ExecutionVisualizer #pyStdout {
border: 1px solid #999999;
font-size: 12pt;
padding: 4px;
font-family: Andale mono, monospace;
overflow: auto; /* to look pretty on IE */
/* make sure textarea doesn't grow and stretch */
resize: none;
}
div.ExecutionVisualizer .vizFrame {
margin-bottom: 20px;
padding-left: 8px;
border-left: 2px solid #cccccc;
}
/* Rendering of primitive types */
div.ExecutionVisualizer .nullObj {
// font-size: 8pt;
}
div.ExecutionVisualizer .stringObj,
div.ExecutionVisualizer .customObj,
div.ExecutionVisualizer .funcObj {
font-family: Andale mono, monospace;
white-space: nowrap;
}
div.ExecutionVisualizer .retval {
font-size: 9pt;
}
div.ExecutionVisualizer .stackFrame .retval {
color: #e93f34; /* highlight non-zombie stack frame return values -
should match brightRed JavaScript variable */
}
/* Rendering of basic compound types */
div.ExecutionVisualizer table.listTbl,
div.ExecutionVisualizer table.tupleTbl,
div.ExecutionVisualizer table.setTbl {
background-color: #ffffc6;
}
div.ExecutionVisualizer table.listTbl {
border: 0px solid black;
border-spacing: 0px;
}
div.ExecutionVisualizer table.listTbl td.listHeader,
div.ExecutionVisualizer table.tupleTbl td.tupleHeader {
padding-left: 4px;
padding-top: 2px;
padding-bottom: 3px;
font-size: 8pt;
color: #777;
text-align: left;
border-left: 1px solid #555555;
}
div.ExecutionVisualizer table.tupleTbl {
border-spacing: 0px;
color: black;
border-bottom: 1px solid #555555; /* must match td.tupleHeader border */
border-top: 1px solid #555555; /* must match td.tupleHeader border */
border-right: 1px solid #555555; /* must match td.tupleHeader border */
}
div.ExecutionVisualizer table.listTbl td.listElt {
border-bottom: 1px solid #555555; /* must match td.listHeader border */
border-left: 1px solid #555555; /* must match td.listHeader border */
}
div.ExecutionVisualizer table.tupleTbl td.tupleElt {
border-left: 1px solid #555555; /* must match td.tupleHeader border */
}
div.ExecutionVisualizer table.customObjTbl {
background-color: white;
color: black;
border: 1px solid black;
}
div.ExecutionVisualizer table.customObjTbl td.customObjElt {
padding: 5px;
}
div.ExecutionVisualizer table.listTbl td.listElt,
div.ExecutionVisualizer table.tupleTbl td.tupleElt {
padding-top: 0px;
padding-bottom: 8px;
padding-left: 10px;
padding-right: 10px;
vertical-align: bottom;
}
div.ExecutionVisualizer table.setTbl {
border: 1px solid #555555;
border-spacing: 0px;
text-align: center;
}
div.ExecutionVisualizer table.setTbl td.setElt {
padding: 8px;
}
div.ExecutionVisualizer table.dictTbl,
div.ExecutionVisualizer table.instTbl,
div.ExecutionVisualizer table.classTbl {
border-spacing: 1px;
}
div.ExecutionVisualizer table.dictTbl td.dictKey,
div.ExecutionVisualizer table.instTbl td.instKey,
div.ExecutionVisualizer table.classTbl td.classKey {
background-color: #faebbf;
}
div.ExecutionVisualizer table.dictTbl td.dictVal,
div.ExecutionVisualizer table.instTbl td.instVal,
div.ExecutionVisualizer table.classTbl td.classVal {
background-color: #ffffc6;
}
div.ExecutionVisualizer table.dictTbl td.dictKey,
div.ExecutionVisualizer table.instTbl td.instKey,
div.ExecutionVisualizer table.classTbl td.classKey {
padding-top: 12px /*15px*/;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 4px;
text-align: right;
}
div.ExecutionVisualizer table.dictTbl td.dictVal,
div.ExecutionVisualizer table.instTbl td.instVal,
div.ExecutionVisualizer table.classTbl td.classVal {
padding-top: 12px /*15px*/;
padding-bottom: 5px;
padding-right: 10px;
padding-left: 4px;
}
div.ExecutionVisualizer table.classTbl td,
div.ExecutionVisualizer table.instTbl td {
border-bottom: 1px #888 solid;
}
div.ExecutionVisualizer table.classTbl td.classVal,
div.ExecutionVisualizer table.instTbl td.instVal {
border-left: 1px #888 solid;
}
div.ExecutionVisualizer table.classTbl {
border-collapse: collapse;
border: 1px #888 solid;
}
/* only add a border to dicts if they're embedded within another object */
div.ExecutionVisualizer td.listElt table.dictTbl,
div.ExecutionVisualizer td.tupleElt table.dictTbl,
div.ExecutionVisualizer td.dictVal table.dictTbl,
div.ExecutionVisualizer td.instVal table.dictTbl,
div.ExecutionVisualizer td.classVal table.dictTbl {
border: 1px #888 solid;
}
div.ExecutionVisualizer .objectIdLabel {
font-size: 8pt;
color: #444;
margin-bottom: 2px;
}
div.ExecutionVisualizer .typeLabel {
font-size: 8pt;
color: #555;
margin-bottom: 2px;
}
div.ExecutionVisualizer div#stack,
div.ExecutionVisualizer div#globals_area {
padding-left: 10px;
padding-right: 30px;
/* no longer necessary ... */
/*float: left;*/
/* border-right: 1px dashed #bbbbbb; */
}
div.ExecutionVisualizer div.stackFrame,
div.ExecutionVisualizer div.zombieStackFrame {
background-color: #ffffff;
margin-bottom: 15px;
padding: 2px;
padding-left: 6px;
padding-right: 6px;
padding-bottom: 4px;
font-size: 10pt;
}
div.ExecutionVisualizer div.zombieStackFrame {
border-left: 1px dotted #aaa;
/*color: #c0c0c0;*/
color: #b0b0b0;
}
div.ExecutionVisualizer div.highlightedStackFrame {
background-color: #d7e7fb;
/*background-color: #c0daf8;*/
/*background-color: #9eeaff #c5dfea;*/
}
div.ExecutionVisualizer div.stackFrame,
div.ExecutionVisualizer div.highlightedStackFrame {
border-left: 1px solid #a6b3b6;
}
div.ExecutionVisualizer div.stackFrameHeader {
font-family: Andale mono, monospace;
font-size: 10pt;
margin-top: 4px;
margin-bottom: 3px;
white-space: nowrap;
}
div.ExecutionVisualizer td.stackFrameVar {
text-align: right;
padding-right: 8px;
padding-top: 3px;
padding-bottom: 3px;
}
div.ExecutionVisualizer td.stackFrameValue {
text-align: left;
border-bottom: 1px solid #aaaaaa;
border-left: 1px solid #aaaaaa;
vertical-align: middle;
padding-top: 3px;
padding-left: 3px;
padding-bottom: 3px;
}
div.ExecutionVisualizer .stackFrameVarTable tr {
}
div.ExecutionVisualizer .stackFrameVarTable {
text-align: right;
padding-top: 3px;
/* right-align the table */
margin-left: auto;
margin-right: 0px;
/* hack to counteract possible nasty CSS reset styles from parent divs */
border-collapse: separate;
border-spacing: 2px;
}
div.ExecutionVisualizer div#heap {
float: left;
padding-left: 30px;
}
div.ExecutionVisualizer td.toplevelHeapObject {
/* needed for d3 to do transitions */
padding-left: 8px;
padding-right: 8px;
padding-top: 4px;
padding-bottom: 4px;
/*
border: 2px dotted white;
border-color: white;
*/
}
div.ExecutionVisualizer table.heapRow {
margin-bottom: 10px;
}
div.ExecutionVisualizer div.heapObject {
padding-left: 2px; /* leave a TINY amount of room for connector endpoints */
}
div.ExecutionVisualizer div.heapPrimitive {
padding-left: 4px; /* leave some more room for connector endpoints */
}
div.ExecutionVisualizer div#stackHeader {
margin-bottom: 15px;
text-align: right;
}
div.ExecutionVisualizer div#heapHeader {
/*margin-top: 2px;
margin-bottom: 13px;*/
margin-bottom: 15px;
}
div.ExecutionVisualizer div#stackHeader,
div.ExecutionVisualizer div#heapHeader {
color: #333333;
font-size: 10pt;
}
div.ExecutionVisualizer #executionSlider {
/* if you set 'width', then it looks ugly when you dynamically resize */
margin-top: 15px;
margin-bottom: 5px;
margin-left: auto;
margin-right: auto;
width: 95%;
}
div.ExecutionVisualizer #executionSliderCaption {
font-size: 8pt;
color: #666666;
margin-top: 15px;
}
div.ExecutionVisualizer #executionSliderFooter {
margin-top: -7px; /* make it butt up against #executionSlider */
}
/* darken slider handle a bit */
div.ExecutionVisualizer .ui-slider .ui-slider-handle {
border: 1px solid #999;
}
/* for annotation bubbles */
/* For styling tricks, see: http://css-tricks.com/textarea-tricks/ */
textarea.bubbleInputText {
border: 1px solid #ccc;
outline: none;
overflow: auto; /* to look pretty on IE */
/* make sure textarea doesn't grow and stretch the enclosing bubble */
resize: none;
width: 225px;
max-width: 225px;
height: 35px;
max-height: 35px;
}
.ui-tooltip-pgbootstrap,
textarea.bubbleInputText {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 9pt;
line-height: 1.3em;
}
/* modified version of Twitter bootstrap style by Philip Guo */
.ui-tooltip-pgbootstrap{
color: #333;
background-color: #ffffff;
max-width: 250px;
min-width: 10px;
border: 2px solid #4284D3;
cursor: pointer;
*border-right-width: 2px;
*border-bottom-width: 2px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
/* way too poofy ...
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
*/
-webkit-box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.2);
box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
.ui-tooltip-pgbootstrap .ui-tooltip-titlebar{
font-size: 18px;
line-height: 22px;
border-bottom: 1px solid #ccc;
background-color: transparent;
}
.ui-tooltip-pgbootstrap .ui-tooltip-content{
padding: 5px /* 5px is minimum or else it might look ugly */ 8px;
}
.ui-tooltip-pgbootstrap .ui-tooltip-titlebar .ui-state-default{
right: 9px; top: 49%;
border-style: none;
}
.ui-tooltip-pgbootstrap .ui-tooltip-icon{
background: white;
}
.ui-tooltip-pgbootstrap .ui-tooltip-icon .ui-icon{
width: auto;
height: auto;
float: right;
font-size: 20px;
font-weight: bold;
line-height: 18px;
color: #000000;
text-shadow: 0 1px 0 #ffffff;
opacity: 0.2;
filter: alpha(opacity=20);
}
.ui-tooltip-pgbootstrap .ui-tooltip-icon .ui-icon:hover{
color: #000000;
text-decoration: none;
cursor: pointer;
opacity: 0.4;
filter: alpha(opacity=40);
}
/* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */
.ui-tooltip-pgbootstrap{
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.ui-tooltip-pgbootstrap-stub{
border: 1px solid #999;
/*
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
*/
}
.ui-tooltip-pgbootstrap-stub .ui-tooltip-content{
padding: 6px 9px;
}
div.ExecutionVisualizer .annotationText,
div.ExecutionVisualizer .vizDescriptionText {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 11pt;
line-height: 1.5em;
}
div.ExecutionVisualizer .vizTitleText {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 16pt;
margin-bottom: 12pt;
}
div.ExecutionVisualizer div#vizHeader {
margin-bottom: 10px;
width: 700px;
max-width: 700px;
}
/* prev then curr, so curr gets precedence when both apply */
div.ExecutionVisualizer .highlight-prev {
background-color: #F0F0EA;
}
div.ExecutionVisualizer .highlight-curr {
background-color: #FFFF66;
}
div.ExecutionVisualizer .highlight-legend {
padding: 2px;
}
/* resizing sliders from David Pritchard */
.ui-resizable-e {
background-color: #dddddd;
width: 1px;
border: 3px solid white;
}
.ui-resizable-e:hover {
border-color: #dddddd;
}
/* for pyCrazyMode */
/* prev then curr, so curr gets precedence when both apply */
div.ExecutionVisualizer .pycrazy-highlight-prev {
background-color: #eeeeee; /*#F0F0EA;*/
/*
text-decoration: none;
border-bottom: 1px solid #dddddd;
*/
}
div.ExecutionVisualizer .pycrazy-highlight-cur {
background-color: #FFFF66;
/* aligned slightly higher than border-bottom */
/*
text-decoration: none;
border-bottom: 1px solid #e93f34;
*/
}
div.ExecutionVisualizer .pycrazy-highlight-prev-and-cur {
background-color: #FFFF66;
text-decoration: none;
border-bottom: 1px solid #999999;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -0,0 +1,316 @@
/*!
* jQuery UI CSS Framework 1.8.21
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
.ui-helper-clearfix:after { clear: both; }
.ui-helper-clearfix { zoom: 1; }
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*!
* jQuery UI CSS Framework 1.8.21
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
/* pgbovine - switch border from #dddddd to #ccc */
.ui-widget-content { border: 1px solid #ccc; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
/* pgbovine - eliminate hover colors */
/*
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
*/
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*!
* jQuery UI Slider 1.8.21
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Slider#theming
*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }

View file

@ -0,0 +1,335 @@
/*!
* jQuery UI CSS Framework 1.8.24
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
.ui-helper-clearfix:after { clear: both; }
.ui-helper-clearfix { zoom: 1; }
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*!
* jQuery UI CSS Framework 1.8.24
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
/* pgbovine - switch border from #dddddd to #ccc */
.ui-widget-content { border: 1px solid #ccc; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
/* pgbovine - eliminate hover colors */
/*
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
*/
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*!
* jQuery UI Resizable 1.8.24
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Resizable#theming
*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*!
* jQuery UI Slider 1.8.24
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Slider#theming
*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,338 @@
CodeMirror.defineMode("python", function(conf, parserConf) {
var ERRORCLASS = 'error';
function wordRegexp(words) {
return new RegExp("^((" + words.join(")|(") + "))\\b");
}
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
'def', 'del', 'elif', 'else', 'except', 'finally',
'for', 'from', 'global', 'if', 'import',
'lambda', 'pass', 'raise', 'return',
'try', 'while', 'with', 'yield'];
var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr',
'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod',
'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset',
'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id',
'input', 'int', 'isinstance', 'issubclass', 'iter', 'len',
'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next',
'object', 'oct', 'open', 'ord', 'pow', 'property', 'range',
'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',
'type', 'vars', 'zip', '__import__', 'NotImplemented',
'Ellipsis', '__debug__'];
var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile',
'file', 'intern', 'long', 'raw_input', 'reduce', 'reload',
'unichr', 'unicode', 'xrange', 'False', 'True', 'None'],
'keywords': ['exec', 'print']};
var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'],
'keywords': ['nonlocal', 'False', 'True', 'None']};
if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
commonkeywords = commonkeywords.concat(py3.keywords);
commonBuiltins = commonBuiltins.concat(py3.builtins);
var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
} else {
commonkeywords = commonkeywords.concat(py2.keywords);
commonBuiltins = commonBuiltins.concat(py2.builtins);
var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
}
var keywords = wordRegexp(commonkeywords);
var builtins = wordRegexp(commonBuiltins);
var indentInfo = null;
// tokenizers
function tokenBase(stream, state) {
// Handle scope changes
if (stream.sol()) {
var scopeOffset = state.scopes[0].offset;
if (stream.eatSpace()) {
var lineOffset = stream.indentation();
if (lineOffset > scopeOffset) {
indentInfo = 'indent';
} else if (lineOffset < scopeOffset) {
indentInfo = 'dedent';
}
return null;
} else {
if (scopeOffset > 0) {
dedent(stream, state);
}
}
}
if (stream.eatSpace()) {
return null;
}
var ch = stream.peek();
// Handle Comments
if (ch === '#') {
stream.skipToEnd();
return 'comment';
}
// Handle Number Literals
if (stream.match(/^[0-9\.]/, false)) {
var floatLiteral = false;
// Floats
if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
if (floatLiteral) {
// Float literals may be "imaginary"
stream.eat(/J/i);
return 'number';
}
// Integers
var intLiteral = false;
// Hex
if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
// Binary
if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
// Octal
if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
// Decimal
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
// Decimal literals may be "imaginary"
stream.eat(/J/i);
// TODO - Can you have imaginary longs?
intLiteral = true;
}
// Zero by itself with no other piece of number.
if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
if (intLiteral) {
// Integer literals may be "long"
stream.eat(/L/i);
return 'number';
}
}
// Handle Strings
if (stream.match(stringPrefixes)) {
state.tokenize = tokenStringFactory(stream.current());
return state.tokenize(stream, state);
}
// Handle operators and Delimiters
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
return null;
}
if (stream.match(doubleOperators)
|| stream.match(singleOperators)
|| stream.match(wordOperators)) {
return 'operator';
}
if (stream.match(singleDelimiters)) {
return null;
}
if (stream.match(keywords)) {
return 'keyword';
}
if (stream.match(builtins)) {
return 'builtin';
}
if (stream.match(identifiers)) {
return 'variable';
}
// Handle non-detected items
stream.next();
return ERRORCLASS;
}
function tokenStringFactory(delimiter) {
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
delimiter = delimiter.substr(1);
}
var singleline = delimiter.length == 1;
var OUTCLASS = 'string';
return function tokenString(stream, state) {
while (!stream.eol()) {
stream.eatWhile(/[^'"\\]/);
if (stream.eat('\\')) {
stream.next();
if (singleline && stream.eol()) {
return OUTCLASS;
}
} else if (stream.match(delimiter)) {
state.tokenize = tokenBase;
return OUTCLASS;
} else {
stream.eat(/['"]/);
}
}
if (singleline) {
if (parserConf.singleLineStringErrors) {
return ERRORCLASS;
} else {
state.tokenize = tokenBase;
}
}
return OUTCLASS;
};
}
function indent(stream, state, type) {
type = type || 'py';
var indentUnit = 0;
if (type === 'py') {
if (state.scopes[0].type !== 'py') {
state.scopes[0].offset = stream.indentation();
return;
}
for (var i = 0; i < state.scopes.length; ++i) {
if (state.scopes[i].type === 'py') {
indentUnit = state.scopes[i].offset + conf.indentUnit;
break;
}
}
} else {
indentUnit = stream.column() + stream.current().length;
}
state.scopes.unshift({
offset: indentUnit,
type: type
});
}
function dedent(stream, state, type) {
type = type || 'py';
if (state.scopes.length == 1) return;
if (state.scopes[0].type === 'py') {
var _indent = stream.indentation();
var _indent_index = -1;
for (var i = 0; i < state.scopes.length; ++i) {
if (_indent === state.scopes[i].offset) {
_indent_index = i;
break;
}
}
if (_indent_index === -1) {
return true;
}
while (state.scopes[0].offset !== _indent) {
state.scopes.shift();
}
return false;
} else {
if (type === 'py') {
state.scopes[0].offset = stream.indentation();
return false;
} else {
if (state.scopes[0].type != type) {
return true;
}
state.scopes.shift();
return false;
}
}
}
function tokenLexer(stream, state) {
indentInfo = null;
var style = state.tokenize(stream, state);
var current = stream.current();
// Handle '.' connected identifiers
if (current === '.') {
style = stream.match(identifiers, false) ? null : ERRORCLASS;
if (style === null && state.lastToken === 'meta') {
// Apply 'meta' style to '.' connected identifiers when
// appropriate.
style = 'meta';
}
return style;
}
// Handle decorators
if (current === '@') {
return stream.match(identifiers, false) ? 'meta' : ERRORCLASS;
}
if ((style === 'variable' || style === 'builtin')
&& state.lastToken === 'meta') {
style = 'meta';
}
// Handle scope changes.
if (current === 'pass' || current === 'return') {
state.dedent += 1;
}
if (current === 'lambda') state.lambda = true;
if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
|| indentInfo === 'indent') {
indent(stream, state);
}
var delimiter_index = '[({'.indexOf(current);
if (delimiter_index !== -1) {
indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
}
if (indentInfo === 'dedent') {
if (dedent(stream, state)) {
return ERRORCLASS;
}
}
delimiter_index = '])}'.indexOf(current);
if (delimiter_index !== -1) {
if (dedent(stream, state, current)) {
return ERRORCLASS;
}
}
if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
if (state.scopes.length > 1) state.scopes.shift();
state.dedent -= 1;
}
return style;
}
var external = {
startState: function(basecolumn) {
return {
tokenize: tokenBase,
scopes: [{offset:basecolumn || 0, type:'py'}],
lastToken: null,
lambda: false,
dedent: 0
};
},
token: function(stream, state) {
var style = tokenLexer(stream, state);
state.lastToken = style;
if (stream.eol() && stream.lambda) {
state.lambda = false;
}
return style;
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase) {
return 0;
}
return state.scopes[0].offset;
}
};
return external;
});
CodeMirror.defineMIME("text/x-python", "python");

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,185 @@
/*
Online Python Tutor
https://github.com/pgbovine/OnlinePythonTutor/
Copyright (C) 2010-2013 Philip J. Guo (philip@pgbovine.net)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Pre-reqs: pytutor.js and jquery.ba-bbq.min.js should be imported BEFORE this file
// backend scripts to execute (Python 2 and 3 variants, if available)
// make two copies of ../web_exec.py and give them the following names,
// then change the first line (starting with #!) to the proper version
// of the Python interpreter (i.e., Python 2 or Python 3).
//var python2_backend_script = 'web_exec_py2.py';
//var python3_backend_script = 'web_exec_py3.py';
// uncomment below if you're running on Google App Engine using the built-in app.yaml
var python2_backend_script = 'exec';
var python3_backend_script = null;
var myVisualizer = null; // singleton ExecutionVisualizer instance
$(document).ready(function() {
var preseededCode = $.bbq.getState('code');
var pyState = $.bbq.getState('py');
var verticalStackBool = ($.bbq.getState('verticalStack') == 'true'); // boolean
var heapPrimitivesBool = ($.bbq.getState('heapPrimitives') == 'true');
var drawParentPointerBool = ($.bbq.getState('drawParentPointers') == 'true');
var textRefsBool = ($.bbq.getState('textReferences') == 'true');
var showOnlyOutputsBool = ($.bbq.getState('showOnlyOutputs') == 'true');
// set up all options in a JS object
var options = {cumulative_mode: ($.bbq.getState('cumulative') == 'true'),
heap_primitives: heapPrimitivesBool,
show_only_outputs: showOnlyOutputsBool,
py_crazy_mode: ($.bbq.getState('py') == '2crazy')};
var preseededCurInstr = Number($.bbq.getState('curInstr'));
if (!preseededCurInstr) {
preseededCurInstr = 0;
}
var backend_script = null;
if (pyState == '2') {
backend_script = python2_backend_script;
}
else if (pyState == '3') {
backend_script = python3_backend_script;
}
if (!backend_script) {
alert('Error: This server is not configured to run Python ' + $('#pythonVersionSelector').val());
return;
}
// David Pritchard's code for resizeContainer option ...
var resizeContainer = ($.bbq.getState('resizeContainer') == 'true');
if (resizeContainer) {
function findContainer() {
var ifs = window.top.document.getElementsByTagName("iframe");
for(var i = 0, len = ifs.length; i < len; i++) {
var f = ifs[i];
var fDoc = f.contentDocument || f.contentWindow.document;
if(fDoc === document) {
return f;
}
}
}
var container = findContainer();
function resizeContainerNow() {
$(container).height($("#vizDiv").height()+20);
};
}
$.get(backend_script,
{user_script : preseededCode,
options_json: JSON.stringify(options)},
function(dataFromBackend) {
var trace = dataFromBackend.trace;
// don't enter visualize mode if there are killer errors:
if (!trace ||
(trace.length == 0) ||
(trace[trace.length - 1].event == 'uncaught_exception')) {
if (trace.length == 1) {
alert(trace[0].exception_msg);
}
else if (trace[trace.length - 1].exception_msg) {
alert(trace[trace.length - 1].exception_msg);
}
else {
alert("Whoa, unknown error! Reload to try again, or report a bug to philip@pgbovine.net\n\n(Click the 'Generate URL' button to include a unique URL in your email bug report.)");
}
}
else {
var startingInstruction = 0;
// only do this at most ONCE, and then clear out preseededCurInstr
if (preseededCurInstr && preseededCurInstr < trace.length) { // NOP anyways if preseededCurInstr is 0
startingInstruction = preseededCurInstr;
}
myVisualizer = new ExecutionVisualizer('vizDiv',
dataFromBackend,
{startingInstruction: preseededCurInstr,
embeddedMode: true,
verticalStack: verticalStackBool,
disableHeapNesting: heapPrimitivesBool,
drawParentPointers: drawParentPointerBool,
textualMemoryLabels: textRefsBool,
showOnlyOutputs: showOnlyOutputsBool,
highlightLines: typeof $.bbq.getState("highlightLines") !== "undefined",
pyCrazyMode: ($.bbq.getState('py') == '2crazy'),
updateOutputCallback: (resizeContainer ? resizeContainerNow : null)
});
// set keyboard bindings
// VERY IMPORTANT to clear and reset this every time or
// else the handlers might be bound multiple times
$(document).unbind('keydown');
$(document).keydown(function(k) {
if (k.keyCode == 37) { // left arrow
if (myVisualizer.stepBack()) {
k.preventDefault(); // don't horizontally scroll the display
}
}
else if (k.keyCode == 39) { // right arrow
if (myVisualizer.stepForward()) {
k.preventDefault(); // don't horizontally scroll the display
}
}
});
}
},
"json");
// log a generic AJAX error handler
$(document).ajaxError(function() {
alert("Online Python Tutor server error (possibly due to memory/resource overload).");
});
// redraw connector arrows on window resize
$(window).resize(function() {
if (typeof appMode !== "undefined" && appMode == 'display') {
myVisualizer.redrawConnectors();
}
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,18 @@
/*
* jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
* http://benalman.com/projects/jquery-bbq-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
/*
* jQuery hashchange event - v1.2 - 2/11/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);

View file

@ -0,0 +1,249 @@
/*!
* jQuery corner plugin: simple corner rounding
* Examples and documentation at: http://jquery.malsup.com/corner/
* version 2.12 (23-MAY-2011)
* Requires jQuery v1.3.2 or later
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Authors: Dave Methvin and Mike Alsup
*/
/**
* corner() takes a single string argument: $('#myDiv').corner("effect corners width")
*
* effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round).
* corners: one or more of: top, bottom, tr, tl, br, or bl. (default is all corners)
* width: width of the effect; in the case of rounded corners this is the radius.
* specify this value using the px suffix such as 10px (yes, it must be pixels).
*/
;(function($) {
var style = document.createElement('div').style,
moz = style['MozBorderRadius'] !== undefined,
webkit = style['WebkitBorderRadius'] !== undefined,
radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined,
mode = document.documentMode || 0,
noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8),
expr = $.browser.msie && (function() {
var div = document.createElement('div');
try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
catch(e) { return false; }
return true;
})();
$.support = $.support || {};
$.support.borderRadius = moz || webkit || radius; // so you can do: if (!$.support.borderRadius) $('#myDiv').corner();
function sz(el, p) {
return parseInt($.css(el,p))||0;
};
function hex2(s) {
s = parseInt(s).toString(16);
return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
while(node) {
var v = $.css(node,'backgroundColor'), rgb;
if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
if (v.indexOf('rgb') >= 0) {
rgb = v.match(/\d+/g);
return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
}
return v;
}
if (node.nodeName.toLowerCase() == 'html')
break;
node = node.parentNode; // keep walking if transparent
}
return '#ffffff';
};
function getWidth(fx, i, width) {
switch(fx) {
case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width))));
case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width))));
case 'sharp': return width-i;
case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
case 'slide': return Math.round(width*(Math.atan2(i,width/i)));
case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1))));
case 'curl': return Math.round(width*(Math.atan(i)));
case 'tear': return Math.round(width*(Math.cos(i)));
case 'wicked': return Math.round(width*(Math.tan(i)));
case 'long': return Math.round(width*(Math.sqrt(i)));
case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
case 'dogfold':
case 'dog': return (i&1) ? (i+1) : width;
case 'dog2': return (i&2) ? (i+1) : width;
case 'dog3': return (i&3) ? (i+1) : width;
case 'fray': return (i%2)*width;
case 'notch': return width;
case 'bevelfold':
case 'bevel': return i+1;
case 'steep': return i/2 + 1;
case 'invsteep':return (width-i)/2+1;
}
};
$.fn.corner = function(options) {
// in 1.3+ we can fix mistakes with the ready state
if (this.length == 0) {
if (!$.isReady && this.selector) {
var s = this.selector, c = this.context;
$(function() {
$(s,c).corner(options);
});
}
return this;
}
return this.each(function(index){
var $this = $(this),
// meta values override options
o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(),
keep = /keep/.test(o), // keep borders?
cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]), // corner color
sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]), // strip color
width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width
re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/,
fx = ((o.match(re)||['round'])[0]),
fold = /dogfold|bevelfold/.test(o),
edges = { T:0, B:1 },
opts = {
TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o),
BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o)
},
// vars used in func later
strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz;
if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
opts = { TL:1, TR:1, BL:1, BR:1 };
// support native rounding
if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
if (opts.TL)
$this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
if (opts.TR)
$this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
if (opts.BL)
$this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
if (opts.BR)
$this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
return;
}
strip = document.createElement('div');
$(strip).css({
overflow: 'hidden',
height: '1px',
minHeight: '1px',
fontSize: '1px',
backgroundColor: sc || 'transparent',
borderStyle: 'solid'
});
pad = {
T: parseInt($.css(this,'paddingTop'))||0, R: parseInt($.css(this,'paddingRight'))||0,
B: parseInt($.css(this,'paddingBottom'))||0, L: parseInt($.css(this,'paddingLeft'))||0
};
if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
if (!keep) this.style.border = 'none';
strip.style.borderColor = cc || gpc(this.parentNode);
cssHeight = $(this).outerHeight();
for (j in edges) {
bot = edges[j];
// only add stips if needed
if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
d = document.createElement('div');
$(d).addClass('jquery-corner');
ds = d.style;
bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);
if (bot && cssHeight != 'auto') {
if ($.css(this,'position') == 'static')
this.style.position = 'relative';
ds.position = 'absolute';
ds.bottom = ds.left = ds.padding = ds.margin = '0';
if (expr)
ds.setExpression('width', 'this.parentNode.offsetWidth');
else
ds.width = '100%';
}
else if (!bot && $.browser.msie) {
if ($.css(this,'position') == 'static')
this.style.position = 'relative';
ds.position = 'absolute';
ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
// fix ie6 problem when blocked element has a border width
if (expr) {
bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
}
else
ds.width = '100%';
}
else {
ds.position = 'relative';
ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' :
(pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';
}
for (i=0; i < width; i++) {
w = Math.max(0,getWidth(fx,i, width));
e = strip.cloneNode(false);
e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
}
if (fold && $.support.boxModel) {
if (bot && noBottomFold) continue;
for (c in opts) {
if (!opts[c]) continue;
if (bot && (c == 'TL' || c == 'TR')) continue;
if (!bot && (c == 'BL' || c == 'BR')) continue;
common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
$horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
switch(c) {
case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
case 'BL': $horz.css({ top: 0, left: 0 }); break;
case 'BR': $horz.css({ top: 0, right: 0 }); break;
}
d.appendChild($horz[0]);
var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
switch(c) {
case 'TL': $vert.css({ left: width }); break;
case 'TR': $vert.css({ right: width }); break;
case 'BL': $vert.css({ left: width }); break;
case 'BR': $vert.css({ right: width }); break;
}
d.appendChild($vert[0]);
}
}
}
}
});
};
$.fn.uncorner = function() {
if (radius || moz || webkit)
this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
$('div.jquery-corner', this).remove();
return this;
};
// expose options
$.fn.corner.defaults = {
useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
metaAttr: 'data-corner' // name of meta attribute to use for options
};
})(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,26 @@
/*
* SimpleModal 1.4.3 - jQuery Plugin
* http://simplemodal.com/
* Copyright (c) 2012 Eric Martin
* Licensed under MIT and GPL
* Date: Sat, Sep 8 2012 07:52:31 -0700
*/
(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):b(jQuery)})(function(b){var j=[],l=b(document),m=b.browser.msie&&6===parseInt(b.browser.version)&&"object"!==typeof window.XMLHttpRequest,o=b.browser.msie&&7===parseInt(b.browser.version),n=null,k=b(window),h=[];b.modal=function(a,d){return b.modal.impl.init(a,d)};b.modal.close=function(){b.modal.impl.close()};b.modal.focus=function(a){b.modal.impl.focus(a)};b.modal.setContainerDimensions=function(){b.modal.impl.setContainerDimensions()};
b.modal.setPosition=function(){b.modal.impl.setPosition()};b.modal.update=function(a,d){b.modal.impl.update(a,d)};b.fn.modal=function(a){return b.modal.impl.init(this,a)};b.modal.defaults={appendTo:"body",focus:!0,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:!1,autoPosition:!0,zIndex:1E3,close:!0,closeHTML:'<a class="modalCloseImg" title="Close"></a>',
closeClass:"simplemodal-close",escClose:!0,overlayClose:!1,fixed:!0,position:null,persist:!1,modal:!0,onOpen:null,onShow:null,onClose:null};b.modal.impl={d:{},init:function(a,d){if(this.d.data)return!1;n=b.browser.msie&&!b.support.boxModel;this.o=b.extend({},b.modal.defaults,d);this.zIndex=this.o.zIndex;this.occb=!1;if("object"===typeof a){if(a=a instanceof b?a:b(a),this.d.placeholder=!1,0<a.parent().parent().size()&&(a.before(b("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"})),
this.d.placeholder=!0,this.display=a.css("display"),!this.o.persist))this.d.orig=a.clone(!0)}else if("string"===typeof a||"number"===typeof a)a=b("<div></div>").html(a);else return alert("SimpleModal Error: Unsupported data type: "+typeof a),this;this.create(a);this.open();b.isFunction(this.o.onShow)&&this.o.onShow.apply(this,[this.d]);return this},create:function(a){this.getDimensions();if(this.o.modal&&m)this.d.iframe=b('<iframe src="javascript:false;"></iframe>').css(b.extend(this.o.iframeCss,
{display:"none",opacity:0,position:"fixed",height:h[0],width:h[1],zIndex:this.o.zIndex,top:0,left:0})).appendTo(this.o.appendTo);this.d.overlay=b("<div></div>").attr("id",this.o.overlayId).addClass("simplemodal-overlay").css(b.extend(this.o.overlayCss,{display:"none",opacity:this.o.opacity/100,height:this.o.modal?j[0]:0,width:this.o.modal?j[1]:0,position:"fixed",left:0,top:0,zIndex:this.o.zIndex+1})).appendTo(this.o.appendTo);this.d.container=b("<div></div>").attr("id",this.o.containerId).addClass("simplemodal-container").css(b.extend({position:this.o.fixed?
"fixed":"absolute"},this.o.containerCss,{display:"none",zIndex:this.o.zIndex+2})).append(this.o.close&&this.o.closeHTML?b(this.o.closeHTML).addClass(this.o.closeClass):"").appendTo(this.o.appendTo);this.d.wrap=b("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(this.d.container);this.d.data=a.attr("id",a.attr("id")||this.o.dataId).addClass("simplemodal-data").css(b.extend(this.o.dataCss,{display:"none"})).appendTo("body");this.setContainerDimensions();
this.d.data.appendTo(this.d.wrap);(m||n)&&this.fixIE()},bindEvents:function(){var a=this;b("."+a.o.closeClass).bind("click.simplemodal",function(b){b.preventDefault();a.close()});a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(b){b.preventDefault();a.close()});l.bind("keydown.simplemodal",function(b){a.o.modal&&9===b.keyCode?a.watchTab(b):a.o.close&&a.o.escClose&&27===b.keyCode&&(b.preventDefault(),a.close())});k.bind("resize.simplemodal orientationchange.simplemodal",
function(){a.getDimensions();a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&a.setPosition();m||n?a.fixIE():a.o.modal&&(a.d.iframe&&a.d.iframe.css({height:h[0],width:h[1]}),a.d.overlay.css({height:j[0],width:j[1]}))})},unbindEvents:function(){b("."+this.o.closeClass).unbind("click.simplemodal");l.unbind("keydown.simplemodal");k.unbind(".simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this.o.position;b.each([this.d.iframe||null,!this.o.modal?null:this.d.overlay,
"fixed"===this.d.container.css("position")?this.d.container:null],function(b,f){if(f){var g=f[0].style;g.position="absolute";if(2>b)g.removeExpression("height"),g.removeExpression("width"),g.setExpression("height",'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"'),g.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"');else{var c,e;a&&a.constructor===
Array?(c=a[0]?"number"===typeof a[0]?a[0].toString():a[0].replace(/px/,""):f.css("top").replace(/px/,""),c=-1===c.indexOf("%")?c+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':parseInt(c.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',a[1]&&(e="number"===typeof a[1]?
a[1].toString():a[1].replace(/px/,""),e=-1===e.indexOf("%")?e+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(e.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"')):(c='(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"',
e='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"');g.removeExpression("top");g.removeExpression("left");g.setExpression("top",c);g.setExpression("left",e)}}})},focus:function(a){var d=this,a=a&&-1!==b.inArray(a,["first","last"])?a:"first",f=b(":input:enabled:visible:"+a,d.d.wrap);setTimeout(function(){0<f.length?f.focus():d.d.wrap.focus()},
10)},getDimensions:function(){var a="undefined"===typeof window.innerHeight?k.height():window.innerHeight;j=[l.height(),l.width()];h=[a,k.width()]},getVal:function(a,b){return a?"number"===typeof a?a:"auto"===a?0:0<a.indexOf("%")?parseInt(a.replace(/%/,""))/100*("h"===b?h[0]:h[1]):parseInt(a.replace(/px/,"")):null},update:function(a,b){if(!this.d.data)return!1;this.d.origHeight=this.getVal(a,"h");this.d.origWidth=this.getVal(b,"w");this.d.data.hide();a&&this.d.container.css("height",a);b&&this.d.container.css("width",
b);this.setContainerDimensions();this.d.data.show();this.o.focus&&this.focus();this.unbindEvents();this.bindEvents()},setContainerDimensions:function(){var a=m||o,d=this.d.origHeight?this.d.origHeight:b.browser.opera?this.d.container.height():this.getVal(a?this.d.container[0].currentStyle.height:this.d.container.css("height"),"h"),a=this.d.origWidth?this.d.origWidth:b.browser.opera?this.d.container.width():this.getVal(a?this.d.container[0].currentStyle.width:this.d.container.css("width"),"w"),f=this.d.data.outerHeight(!0),
g=this.d.data.outerWidth(!0);this.d.origHeight=this.d.origHeight||d;this.d.origWidth=this.d.origWidth||a;var c=this.o.maxHeight?this.getVal(this.o.maxHeight,"h"):null,e=this.o.maxWidth?this.getVal(this.o.maxWidth,"w"):null,c=c&&c<h[0]?c:h[0],e=e&&e<h[1]?e:h[1],i=this.o.minHeight?this.getVal(this.o.minHeight,"h"):"auto",d=d?this.o.autoResize&&d>c?c:d<i?i:d:f?f>c?c:this.o.minHeight&&"auto"!==i&&f<i?i:f:i,c=this.o.minWidth?this.getVal(this.o.minWidth,"w"):"auto",a=a?this.o.autoResize&&a>e?e:a<c?c:a:
g?g>e?e:this.o.minWidth&&"auto"!==c&&g<c?c:g:c;this.d.container.css({height:d,width:a});this.d.wrap.css({overflow:f>d||g>a?"auto":"visible"});this.o.autoPosition&&this.setPosition()},setPosition:function(){var a,b;a=h[0]/2-this.d.container.outerHeight(!0)/2;b=h[1]/2-this.d.container.outerWidth(!0)/2;var f="fixed"!==this.d.container.css("position")?k.scrollTop():0;this.o.position&&"[object Array]"===Object.prototype.toString.call(this.o.position)?(a=f+(this.o.position[0]||a),b=this.o.position[1]||
b):a=f+a;this.d.container.css({left:b,top:a})},watchTab:function(a){if(0<b(a.target).parents(".simplemodal-container").length){if(this.inputs=b(":input:enabled:visible:first, :input:enabled:visible:last",this.d.data[0]),!a.shiftKey&&a.target===this.inputs[this.inputs.length-1]||a.shiftKey&&a.target===this.inputs[0]||0===this.inputs.length)a.preventDefault(),this.focus(a.shiftKey?"last":"first")}else a.preventDefault(),this.focus()},open:function(){this.d.iframe&&this.d.iframe.show();b.isFunction(this.o.onOpen)?
this.o.onOpen.apply(this,[this.d]):(this.d.overlay.show(),this.d.container.show(),this.d.data.show());this.o.focus&&this.focus();this.bindEvents()},close:function(){if(!this.d.data)return!1;this.unbindEvents();if(b.isFunction(this.o.onClose)&&!this.occb)this.occb=!0,this.o.onClose.apply(this,[this.d]);else{if(this.d.placeholder){var a=b("#simplemodal-placeholder");this.o.persist?a.replaceWith(this.d.data.removeClass("simplemodal-data").css("display",this.display)):(this.d.data.hide().remove(),a.replaceWith(this.d.orig))}else this.d.data.hide().remove();
this.d.container.hide().remove();this.d.overlay.hide();this.d.iframe&&this.d.iframe.hide().remove();this.d.overlay.remove();this.d={}}}}});

View file

@ -0,0 +1,631 @@
/*
Online Python Tutor
https://github.com/pgbovine/OnlinePythonTutor/
Copyright (C) 2010-2013 Philip J. Guo (philip@pgbovine.net)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Pre-reqs: pytutor.js and jquery.ba-bbq.min.js should be imported BEFORE this file
// backend scripts to execute (Python 2 and 3 variants, if available)
// make two copies of ../web_exec.py and give them the following names,
// then change the first line (starting with #!) to the proper version
// of the Python interpreter (i.e., Python 2 or Python 3).
// Note that your hosting provider might have stringent rules for what
// kind of scripts are allowed to execute. For instance, my provider
// (Webfaction) seems to let scripts execute only if permissions are
// something like:
// -rwxr-xr-x 1 pgbovine pgbovine 2.5K Jul 5 22:46 web_exec_py2.py*
// (most notably, only the owner of the file should have write
// permissions)
//var python2_backend_script = 'web_exec_py2.py';
//var python3_backend_script = 'web_exec_py3.py';
// uncomment below if you're running on Google App Engine using the built-in app.yaml
var python2_backend_script = 'exec';
var python3_backend_script = null;
// KRAZY experimental KODE!!! Use a custom hacked CPython interpreter
var python2crazy_backend_script = 'web_exec_py2-crazy.py';
// On Google App Engine, simply run dev_appserver.py with the
// crazy custom CPython interpreter to get 2crazy
//var python2crazy_backend_script = 'exec';
var appMode = 'edit'; // 'edit', 'display', or 'display_no_frills'
var preseededCode = null; // if you passed in a 'code=<code string>' in the URL, then set this var
var preseededCurInstr = null; // if you passed in a 'curInstr=<number>' in the URL, then set this var
var rawInputLst = []; // a list of strings inputted by the user in response to raw_input or mouse_input events
var myVisualizer = null; // singleton ExecutionVisualizer instance
function enterEditMode() {
$.bbq.pushState({ mode: 'edit' }, 2 /* completely override other hash strings to keep URL clean */);
}
function enterDisplayNoFrillsMode() {
$.bbq.pushState({ mode: 'display_no_frills' }, 2 /* completely override other hash strings to keep URL clean */);
}
var pyInputCodeMirror; // CodeMirror object that contains the input text
function setCodeMirrorVal(dat) {
pyInputCodeMirror.setValue(dat.rtrim() /* kill trailing spaces */);
$('#urlOutput,#embedCodeOutput').val('');
// also scroll to top to make the UI more usable on smaller monitors
$(document).scrollTop(0);
}
$(document).ready(function() {
$("#embedLinkDiv").hide();
pyInputCodeMirror = CodeMirror(document.getElementById('codeInputPane'), {
mode: 'python',
lineNumbers: true,
tabSize: 4,
indentUnit: 4,
// convert tab into four spaces:
extraKeys: {Tab: function(cm) {cm.replaceSelection(" ", "end");}}
});
pyInputCodeMirror.setSize(null, '420px');
// be friendly to the browser's forward and back buttons
// thanks to http://benalman.com/projects/jquery-bbq-plugin/
$(window).bind("hashchange", function(e) {
appMode = $.bbq.getState('mode'); // assign this to the GLOBAL appMode
if (appMode === undefined || appMode == 'edit') {
$("#pyInputPane").show();
$("#pyOutputPane").hide();
$("#embedLinkDiv").hide();
// destroy all annotation bubbles (NB: kludgy)
if (myVisualizer) {
myVisualizer.destroyAllAnnotationBubbles();
}
}
else if (appMode == 'display') {
$("#pyInputPane").hide();
$("#pyOutputPane").show();
$("#embedLinkDiv").show();
$('#executeBtn').html("Visualize execution");
$('#executeBtn').attr('disabled', false);
// do this AFTER making #pyOutputPane visible, or else
// jsPlumb connectors won't render properly
myVisualizer.updateOutput();
// customize edit button click functionality AFTER rendering (NB: awkward!)
$('#pyOutputPane #editCodeLinkDiv').show();
$('#pyOutputPane #editBtn').click(function() {
enterEditMode();
});
}
else if (appMode == 'display_no_frills') {
$("#pyInputPane").hide();
$("#pyOutputPane").show();
$("#embedLinkDiv").show();
}
else {
assert(false);
}
$('#urlOutput,#embedCodeOutput').val(''); // clear to avoid stale values
});
function executeCode(forceStartingInstr) {
var backend_script = null;
if ($('#pythonVersionSelector').val() == '2') {
backend_script = python2_backend_script;
}
else if ($('#pythonVersionSelector').val() == '3') {
backend_script = python3_backend_script;
}
// experimental KRAZY MODE!!!
else if ($('#pythonVersionSelector').val() == '2crazy') {
backend_script = python2crazy_backend_script;
}
if (!backend_script) {
alert('Error: This server is not configured to run Python ' + $('#pythonVersionSelector').val());
return;
}
$('#executeBtn').html("Please wait ... processing your code");
$('#executeBtn').attr('disabled', true);
$("#pyOutputPane").hide();
$("#embedLinkDiv").hide();
// set up all options in a JS object
var options = {cumulative_mode: ($('#cumulativeModeSelector').val() == 'true'),
heap_primitives: ($('#heapPrimitivesSelector').val() == 'true'),
show_only_outputs: ($('#showOnlyOutputsSelector').val() == 'true'),
py_crazy_mode: ($('#pythonVersionSelector').val() == '2crazy')};
$.get(backend_script,
{user_script : pyInputCodeMirror.getValue(),
raw_input_json: rawInputLst.length > 0 ? JSON.stringify(rawInputLst) : '',
options_json: JSON.stringify(options)},
function(dataFromBackend) {
var trace = dataFromBackend.trace;
// don't enter visualize mode if there are killer errors:
if (!trace ||
(trace.length == 0) ||
(trace[trace.length - 1].event == 'uncaught_exception')) {
if (trace.length == 1) {
var errorLineNo = trace[0].line - 1; /* CodeMirror lines are zero-indexed */
if (errorLineNo !== undefined) {
// highlight the faulting line in pyInputCodeMirror
pyInputCodeMirror.focus();
pyInputCodeMirror.setCursor(errorLineNo, 0);
pyInputCodeMirror.setLineClass(errorLineNo, null, 'errorLine');
pyInputCodeMirror.setOption('onChange', function() {
pyInputCodeMirror.setLineClass(errorLineNo, null, null); // reset line back to normal
pyInputCodeMirror.setOption('onChange', null); // cancel
});
}
alert(trace[0].exception_msg);
}
else if (trace[trace.length - 1].exception_msg) {
alert(trace[trace.length - 1].exception_msg);
}
else {
alert("Whoa, unknown error! Reload to try again, or report a bug to philip@pgbovine.net\n\n(Click the 'Generate URL' button to include a unique URL in your email bug report.)");
}
$('#executeBtn').html("Visualize execution");
$('#executeBtn').attr('disabled', false);
}
else {
var startingInstruction = 0;
// only do this at most ONCE, and then clear out preseededCurInstr
if (preseededCurInstr && preseededCurInstr < trace.length) { // NOP anyways if preseededCurInstr is 0
startingInstruction = preseededCurInstr;
preseededCurInstr = null;
}
// forceStartingInstr overrides everything else
if (forceStartingInstr !== undefined) {
startingInstruction = forceStartingInstr;
}
myVisualizer = new ExecutionVisualizer('pyOutputPane',
dataFromBackend,
{startingInstruction: startingInstruction,
updateOutputCallback: function() {$('#urlOutput,#embedCodeOutput').val('');},
// tricky: selector 'true' and 'false' values are strings!
disableHeapNesting: ($('#heapPrimitivesSelector').val() == 'true'),
drawParentPointers: ($('#drawParentPointerSelector').val() == 'true'),
textualMemoryLabels: ($('#textualMemoryLabelsSelector').val() == 'true'),
showOnlyOutputs: ($('#showOnlyOutputsSelector').val() == 'true'),
executeCodeWithRawInputFunc: executeCodeWithRawInput,
// undocumented experimental modes:
pyCrazyMode: ($('#pythonVersionSelector').val() == '2crazy'),
//allowEditAnnotations: true,
});
// set keyboard bindings
// VERY IMPORTANT to clear and reset this every time or
// else the handlers might be bound multiple times
$(document).unbind('keydown');
$(document).keydown(function(k) {
if (k.keyCode == 37) { // left arrow
if (myVisualizer.stepBack()) {
k.preventDefault(); // don't horizontally scroll the display
}
}
else if (k.keyCode == 39) { // right arrow
if (myVisualizer.stepForward()) {
k.preventDefault(); // don't horizontally scroll the display
}
}
});
// also scroll to top to make the UI more usable on smaller monitors
$(document).scrollTop(0);
$.bbq.pushState({ mode: 'display' }, 2 /* completely override other hash strings to keep URL clean */);
}
},
"json");
}
function executeCodeFromScratch() {
// reset these globals
rawInputLst = [];
executeCode();
}
function executeCodeWithRawInput(rawInputStr, curInstr) {
enterDisplayNoFrillsMode();
// set some globals
rawInputLst.push(rawInputStr);
executeCode(curInstr);
}
$("#executeBtn").attr('disabled', false);
$("#executeBtn").click(executeCodeFromScratch);
// canned examples
$("#tutorialExampleLink").click(function() {
$.get("example-code/py_tutorial.txt", setCodeMirrorVal);
return false;
});
$("#strtokExampleLink").click(function() {
$.get("example-code/strtok.txt", setCodeMirrorVal);
return false;
});
$("#listCompLink").click(function() {
$.get("example-code/list-comp.txt", setCodeMirrorVal);
return false;
});
$("#fibonacciExampleLink").click(function() {
$.get("example-code/fib.txt", setCodeMirrorVal);
return false;
});
$("#memoFibExampleLink").click(function() {
$.get("example-code/memo_fib.txt", setCodeMirrorVal);
return false;
});
$("#factExampleLink").click(function() {
$.get("example-code/fact.txt", setCodeMirrorVal);
return false;
});
$("#filterExampleLink").click(function() {
$.get("example-code/filter.txt", setCodeMirrorVal);
return false;
});
$("#insSortExampleLink").click(function() {
$.get("example-code/ins_sort.txt", setCodeMirrorVal);
return false;
});
$("#aliasExampleLink").click(function() {
$.get("example-code/aliasing.txt", setCodeMirrorVal);
return false;
});
$("#happyExampleLink").click(function() {
$.get("example-code/happy.txt", setCodeMirrorVal);
return false;
});
$("#newtonExampleLink").click(function() {
$.get("example-code/sqrt.txt", setCodeMirrorVal);
return false;
});
$("#oopSmallExampleLink").click(function() {
$.get("example-code/oop_small.txt", setCodeMirrorVal);
return false;
});
$("#mapExampleLink").click(function() {
$.get("example-code/map.txt", setCodeMirrorVal);
return false;
});
$("#rawInputExampleLink").click(function() {
$.get("example-code/raw_input.txt", setCodeMirrorVal);
return false;
});
$("#oop1ExampleLink").click(function() {
$.get("example-code/oop_1.txt", setCodeMirrorVal);
return false;
});
$("#oop2ExampleLink").click(function() {
$.get("example-code/oop_2.txt", setCodeMirrorVal);
return false;
});
$("#inheritanceExampleLink").click(function() {
$.get("example-code/oop_inherit.txt", setCodeMirrorVal);
return false;
});
$("#sumExampleLink").click(function() {
$.get("example-code/sum.txt", setCodeMirrorVal);
return false;
});
$("#pwGcdLink").click(function() {
$.get("example-code/wentworth_gcd.txt", setCodeMirrorVal);
return false;
});
$("#pwSumListLink").click(function() {
$.get("example-code/wentworth_sumList.txt", setCodeMirrorVal);
return false;
});
$("#towersOfHanoiLink").click(function() {
$.get("example-code/towers_of_hanoi.txt", setCodeMirrorVal);
return false;
});
$("#pwTryFinallyLink").click(function() {
$.get("example-code/wentworth_try_finally.txt", setCodeMirrorVal);
return false;
});
$("#sumCubesLink").click(function() {
$.get("example-code/sum-cubes.txt", setCodeMirrorVal);
return false;
});
$("#decoratorsLink").click(function() {
$.get("example-code/decorators.txt", setCodeMirrorVal);
return false;
});
$("#genPrimesLink").click(function() {
$.get("example-code/gen_primes.txt", setCodeMirrorVal);
return false;
});
$("#genExprLink").click(function() {
$.get("example-code/genexpr.txt", setCodeMirrorVal);
return false;
});
$('#closure1Link').click(function() {
$.get("example-code/closures/closure1.txt", setCodeMirrorVal);
return false;
});
$('#closure2Link').click(function() {
$.get("example-code/closures/closure2.txt", setCodeMirrorVal);
return false;
});
$('#closure3Link').click(function() {
$.get("example-code/closures/closure3.txt", setCodeMirrorVal);
return false;
});
$('#closure4Link').click(function() {
$.get("example-code/closures/closure4.txt", setCodeMirrorVal);
return false;
});
$('#closure5Link').click(function() {
$.get("example-code/closures/closure5.txt", setCodeMirrorVal);
return false;
});
$('#lambdaParamLink').click(function() {
$.get("example-code/closures/lambda-param.txt", setCodeMirrorVal);
return false;
});
$('#tortureLink').click(function() {
$.get("example-code/closures/student-torture.txt", setCodeMirrorVal);
return false;
});
$('#aliasing1Link').click(function() {
$.get("example-code/aliasing/aliasing1.txt", setCodeMirrorVal);
return false;
});
$('#aliasing2Link').click(function() {
$.get("example-code/aliasing/aliasing2.txt", setCodeMirrorVal);
return false;
});
$('#aliasing3Link').click(function() {
$.get("example-code/aliasing/aliasing3.txt", setCodeMirrorVal);
return false;
});
$('#aliasing4Link').click(function() {
$.get("example-code/aliasing/aliasing4.txt", setCodeMirrorVal);
return false;
});
$('#aliasing5Link').click(function() {
$.get("example-code/aliasing/aliasing5.txt", setCodeMirrorVal);
return false;
});
$('#aliasing6Link').click(function() {
$.get("example-code/aliasing/aliasing6.txt", setCodeMirrorVal);
return false;
});
$('#aliasing7Link').click(function() {
$.get("example-code/aliasing/aliasing7.txt", setCodeMirrorVal);
return false;
});
$('#aliasing8Link').click(function() {
$.get("example-code/aliasing/aliasing8.txt", setCodeMirrorVal);
return false;
});
$('#ll1Link').click(function() {
$.get("example-code/linked-lists/ll1.txt", setCodeMirrorVal);
return false;
});
$('#ll2Link').click(function() {
$.get("example-code/linked-lists/ll2.txt", setCodeMirrorVal);
return false;
});
$('#sumListLink').click(function() {
$.get("example-code/sum-list.txt", setCodeMirrorVal);
return false;
});
$('#varargsLink').click(function() {
$.get("example-code/varargs.txt", setCodeMirrorVal);
return false;
});
$('#forElseLink').click(function() {
$.get("example-code/for-else.txt", setCodeMirrorVal);
return false;
});
$('#nonlocalLink').click(function() {
$.get("example-code/nonlocal.txt", setCodeMirrorVal);
return false;
});
// handle hash parameters passed in when loading the page
preseededCode = $.bbq.getState('code');
if (preseededCode) {
setCodeMirrorVal(preseededCode);
}
else {
// select a canned example on start-up:
$("#aliasExampleLink").trigger('click');
}
// parse query string options ...
// ugh, ugly tristate due to the possibility of them being undefined
var cumulativeState = $.bbq.getState('cumulative');
if (cumulativeState !== undefined) {
$('#cumulativeModeSelector').val(cumulativeState);
}
var heapPrimitivesState = $.bbq.getState('heapPrimitives');
if (heapPrimitivesState !== undefined) {
$('#heapPrimitivesSelector').val(heapPrimitivesState);
}
var drawParentPointerState = $.bbq.getState('drawParentPointers');
if (drawParentPointerState !== undefined) {
$('#drawParentPointerSelector').val(drawParentPointerState);
}
var textRefsState = $.bbq.getState('textReferences');
if (textRefsState !== undefined) {
$('#textualMemoryLabelsSelector').val(textRefsState);
}
var showOnlyOutputsState = $.bbq.getState('showOnlyOutputs');
if (showOnlyOutputsState !== undefined) {
$('#showOnlyOutputsSelector').val(showOnlyOutputsState);
}
var pyState = $.bbq.getState('py');
if (pyState !== undefined) {
$('#pythonVersionSelector').val(pyState);
}
appMode = $.bbq.getState('mode'); // assign this to the GLOBAL appMode
if ((appMode == "display") && preseededCode /* jump to display only with pre-seeded code */) {
preseededCurInstr = Number($.bbq.getState('curInstr'));
$("#executeBtn").trigger('click');
}
else {
if (appMode === undefined) {
// default mode is 'edit', don't trigger a "hashchange" event
appMode = 'edit';
}
else {
// fail-soft by killing all passed-in hashes and triggering a "hashchange"
// event, which will then go to 'edit' mode
$.bbq.removeState();
}
}
// log a generic AJAX error handler
$(document).ajaxError(function() {
alert("Server error (possibly due to memory/resource overload). Report a bug to philip@pgbovine.net\n\n(Click the 'Generate URL' button to include a unique URL in your email bug report.)");
$('#executeBtn').html("Visualize execution");
$('#executeBtn').attr('disabled', false);
});
// redraw connector arrows on window resize
$(window).resize(function() {
if (appMode == 'display') {
myVisualizer.redrawConnectors();
}
});
$('#genUrlBtn').bind('click', function() {
var myArgs = {code: pyInputCodeMirror.getValue(),
mode: appMode,
cumulative: $('#cumulativeModeSelector').val(),
heapPrimitives: $('#heapPrimitivesSelector').val(),
drawParentPointers: $('#drawParentPointerSelector').val(),
textReferences: $('#textualMemoryLabelsSelector').val(),
showOnlyOutputs: $('#showOnlyOutputsSelector').val(),
py: $('#pythonVersionSelector').val()};
if (appMode == 'display') {
myArgs.curInstr = myVisualizer.curInstr;
}
var urlStr = $.param.fragment(window.location.href, myArgs, 2 /* clobber all */);
$('#urlOutput').val(urlStr);
});
$('#genEmbedBtn').bind('click', function() {
assert(appMode == 'display');
var myArgs = {code: pyInputCodeMirror.getValue(),
cumulative: $('#cumulativeModeSelector').val(),
heapPrimitives: $('#heapPrimitivesSelector').val(),
drawParentPointers: $('#drawParentPointerSelector').val(),
textReferences: $('#textualMemoryLabelsSelector').val(),
showOnlyOutputs: $('#showOnlyOutputsSelector').val(),
py: $('#pythonVersionSelector').val(),
curInstr: myVisualizer.curInstr,
};
var embedUrlStr = $.param.fragment('http://pythontutor.com/iframe-embed.html', myArgs, 2 /* clobber all */);
var iframeStr = '<iframe width="800" height="500" frameborder="0" src="' + embedUrlStr + '"> </iframe>';
$('#embedCodeOutput').val(iframeStr);
});
});

View file

@ -0,0 +1,118 @@
/*
Online Python Tutor
https://github.com/pgbovine/OnlinePythonTutor/
Copyright (C) 2010-2013 Philip J. Guo (philip@pgbovine.net)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Pre-reqs: pytutor.js and jquery.ba-bbq.min.js should be imported BEFORE this file
var backend_script = 'exec'; // URL of backend script, which must eventually call pg_logger.py
var myVisualizer = null; // singleton ExecutionVisualizer instance
var lessonScript = null;
var metadataJSON = null;
function parseLessonFile(dat) {
var toks = dat.split('======');
// globals
lessonScript = toks[0].rtrim();
metadataJSON = $.parseJSON(toks[1]);
$('#lessonTitle').html(metadataJSON.title);
$('#lessonDescription').html(metadataJSON.description);
document.title = metadataJSON.title + ' - Online Python Tutor (v3)';
$.get(backend_script,
{user_script : lessonScript},
function(dataFromBackend) {
var trace = dataFromBackend.trace;
// don't enter visualize mode if there are killer errors:
if (!trace ||
(trace.length == 0) ||
(trace[trace.length - 1].event == 'uncaught_exception')) {
if (trace.length == 1) {
alert(trace[0].exception_msg);
}
else {
alert("Whoa, unknown error! Reload to try again, or report a bug to philip@pgbovine.net\n\n(Click the 'Generate URL' button to include a unique URL in your email bug report.)");
}
}
else {
myVisualizer = new ExecutionVisualizer('pyOutputPane',
dataFromBackend,
{embeddedMode: true,
updateOutputCallback: updateLessonNarration});
myVisualizer.updateOutput();
}
},
"json");
}
function updateLessonNarration(myViz) {
var curInstr = myViz.curInstr;
assert(metadataJSON);
var annotation = metadataJSON[curInstr + 1]; // adjust for indexing diffs
if (annotation) {
$('#lessonNarration').html(annotation);
}
else {
$('#lessonNarration').html('');
}
// hack from John DeNero to ensure that once a div grows it height, it
// never shrinks again
$('#lessonNarration').css('min-height', $('#lessonNarration').css('height'));
}
$(document).ready(function() {
//$.get("lessons/aliasing.txt", parseLessonFile);
//$.get("lessons/dive-into-python-311.txt", parseLessonFile);
//$.get("lessons/for-else.txt", parseLessonFile);
$.get("lessons/varargs.txt", parseLessonFile);
// log a generic AJAX error handler
$(document).ajaxError(function() {
alert("Server error (possibly due to memory/resource overload).");
});
// redraw connector arrows on window resize
$(window).resize(function() {
if (myVisualizer) {
myVisualizer.redrawConnectors();
}
});
});

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,91 @@
/**
* jQuery sound plugin (no flash)
*
* port of script.aculo.us' sound.js (http://script.aculo.us), based on code by Jules Gravinese (http://www.webveteran.com/)
*
* Copyright (c) 2007 Jörn Zaefferer (http://bassistance.de)
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* $Id: jquery.sound.js 5854 2008-10-04 10:22:25Z joern.zaefferer $
*/
/**
* API Documentation
*
* // play a sound from the url
* $.sound.play(url)
*
* // play a sound from the url, on a track, stopping any sound already running on that track
* $.sound.play(url, {
* track: "track1"
* });
*
* // increase the timeout to four seconds before removing the sound object from the dom for longer sounds
* $.sound.play(url, {
* timeout: 4000
* });
*
* // stop a sound by removing the element returned by play
* var sound = $.sound.play(url);
* sound.remove();
*
* // disable playing sounds
* $.sound.enabled = false;
*
* // enable playing sounds
* $.sound.enabled = true
*/
(function($) {
$.sound = {
tracks: {},
enabled: true,
template: function(src) {
// todo: move bgsound element and browser sniffing in here
// todo: test wmv on windows: Builder.node('embed', {type:'application/x-mplayer2', pluginspage:'http://microsoft.com/windows/mediaplayer/en/download/', id:'mediaPlayer', name:'mediaPlayer', displaysize:'4', autosize:'-1', bgcolor:'darkblue', showcontrols:'false', showtracker:'-1', showdisplay:'0', showstatusbar:'-1', videoborder3d:'-1', width:'0', height:'0', src:audioFile, autostart:'true', designtimesp:'5311', loop:'false'});
// is_win = (agt.indexOf("windows") != -1);
return '<embed style="height:0" loop="false" src="' + src + '" autostart="true" hidden="true"/>';
},
play: function(url, options){
if (!this.enabled)
return;
options = $.extend({
url: url,
timeout: 2000
}, options);
if (options.track) {
if (this.tracks[options.track]) {
var current = this.tracks[options.track];
// TODO check when Stop is avaiable, certainly not on a jQuery object
current[0].Stop && current[0].Stop();
current.remove();
}
}
var element = $.browser.msie
? $('<bgsound/>').attr({
src: options.url,
loop: 1,
autostart: true
})
: $(this.template(options.url));
element.appendTo("body");
if (options.track) {
this.tracks[options.track] = element;
}
setTimeout(function() {
element.remove();
}, options.timeout)
return element;
}
};
})(jQuery);

View file

@ -0,0 +1,120 @@
/* FEEDBACK:
- peräkkäiset rivit yhdistetään blokeiksi
- etsitään LIS jossa eniten peräkkäisiä rivejä
- värjätään LIS:n inverse punaiseksi, blokeista ehkä vain tausta
- sisennyspalaute kuten nykyisin alusta asti oikealla paikalla olevista riveistä (värjätäänkö vihreiksi?)
*/
// Takes an iterable sequence and returns the decks given by
// patience sorting as a list of lists
// http://wordaligned.org/articles/patience-sort
// http://en.wikipedia.org/wiki/Longest_increasing_subsequence
var LIS = {};
(function($, _) { // wrap in anonymous function to allow overriding of _ and $
LIS.patience_sort = function(list) {
var arr = _.toArray(list),
decks = [[arr[0]]],
deckPos = 0;
for (var i = 1; i < arr.length; i++) {
var x = arr[i],
currDeck = decks[deckPos];
if (x < _.last(currDeck)) {
// append to the last created deck
currDeck.push(x);
} else {
// create a new deck
decks.push([x]);
deckPos++;
}
}
return decks;
};
// Takes an iterable sequence of iterables that represent decks
// that are the result of patience sorting a sequence
LIS.find_lises = function(decks) {
decks = _.toArray(decks);
if (decks.length < 1) {
return decks;
}
var lises = [],
new_lises,
deck,
partial_lis,
partial_lis_extended,
x, i, j, k;
for (i = 0; i < decks.length; i++) {
new_lises = [];
deck = decks[i];
for (j = 0; j < lises.length; j++) {
partial_lis = lises[j];
for (k = 0; k < deck.length; k++) {
x = deck[k];
if (x > _.last(partial_lis)) {
new_partial_lis = partial_lis.slice(0); // dummy copy
new_partial_lis.push(x);
new_lises.push(new_partial_lis);
}
}
new_lises.push(partial_lis);
}
for (k = 0; k < deck.length; k++) {
new_lises.push([deck[k]]);
}
lises = new_lises;
}
lis_length = _.max(_.map(lises, function(item) { return item.length; }));
lises = _.select(lises, function(item) { return item.length >= lis_length; });
return lises;
};
LIS.best_lise = function(lises) {
var lis_scores = _.map(lises, function(item, index) {
if (item.length <= 1) {
return {score: 0, index: index};
}
var score = 0;
for (var i = 1; i < item.length; i++) {
if (item[i-1] == item[i] - 1) {
score++;
}
}
return {score: score, index: index};
});
var best = _.max(lis_scores, function(item) { return item.score; });
return lises[best.index];
};
LIS.best_lise_inverse = function(list) {
var decks = this.patience_sort(_.toArray(list)),
lises = this.find_lises(decks),
best = this.best_lise(lises);
return _.difference(list, best);
};
// Takes an iterable sequence and returns a list of the inverses of
// all the longest increasing subsequences of this sequence
/*
function lis_inverses(list) {
var inverse_list = [],
decks = patience_sort(_.toArray(list)),
lises = find_lises(decks);
return _.map(lises, function(item) { return _.difference(list, item); });
}
function in_all_lis_inverses(list) {
var inverse_list = lis_inverses(list);
return _.intersection.apply(null, inverse_list);
}
function inverse_indices(list) {
var in_all = in_all_lis_inverses(list);
return _.map(in_all, function(item) { return list.indexOf(item); });
};*/
//This allows the current version of _ and $ to be used, even if it is later reverted
//with noConflict
})($, _);

View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1 @@
.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}pre.prettyprint{padding:2px;border:1px solid #888}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}

View file

@ -0,0 +1,622 @@
function H() {
var x = navigator && navigator.userAgent
&& /\bMSIE 6\./.test(navigator.userAgent);
H = function() {
return x
};
return x
}
( function() {
function x(b) {
b = b.split(/ /g);
var a = {};
for ( var c = b.length; --c >= 0;) {
var d = b[c];
if (d)
a[d] = null
}
return a
}
var y = "break continue do else for if return while ", U = y
+ "auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile ", D = U
+ "catch class delete false import new operator private protected public this throw true try ", I = D
+ "alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ", J = D
+ "boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ", V = J
+ "as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ", K = D
+ "debugger eval export function get null set undefined var with Infinity NaN ", L = "caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ", M = y
+ "and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ", N = y
+ "alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ", O = y
+ "case done elif esac eval fi function in local set then until ", W = I
+ V + K + L + M + N + O;
function X(b) {
return b >= "a" && b <= "z" || b >= "A" && b <= "Z"
}
function u(b, a, c, d) {
b.unshift(c, d || 0);
try {
a.splice.apply(a, b)
} finally {
b.splice(0, 2)
}
}
var Y = ( function() {
var b = [ "!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=", "&=",
"(", "*", "*=", "+=", ",", "-=", "->", "/", "/=", ":", "::",
";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>",
">>=", ">>>", ">>>=", "?", "@", "[", "^", "^=", "^^", "^^=",
"{", "|", "|=", "||", "||=", "~", "break", "case", "continue",
"delete", "do", "else", "finally", "instanceof", "return",
"throw", "try", "typeof" ], a = "(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)";
for ( var c = 0; c < b.length; ++c) {
var d = b[c];
a += X(d.charAt(0)) ? "|\\b" + d : "|"
+ d.replace(/([^=<>:&])/g, "\\$1")
}
a += "|^)\\s*$";
return new RegExp(a)
})(), P = /&/g, Q = /</g, R = />/g, Z = /\"/g;
function $(b) {
return b.replace(P, "&amp;").replace(Q, "&lt;").replace(R, "&gt;")
.replace(Z, "&quot;")
}
function E(b) {
return b.replace(P, "&amp;").replace(Q, "&lt;").replace(R, "&gt;")
}
var aa = /&lt;/g, ba = /&gt;/g, ca = /&apos;/g, da = /&quot;/g, ea = /&amp;/g, fa = /&nbsp;/g;
function ga(b) {
var a = b.indexOf("&");
if (a < 0)
return b;
for (--a; (a = b.indexOf("&#", a + 1)) >= 0;) {
var c = b.indexOf(";", a);
if (c >= 0) {
var d = b.substring(a + 3, c), g = 10;
if (d && d.charAt(0) === "x") {
d = d.substring(1);
g = 16
}
var e = parseInt(d, g);
if (!isNaN(e))
b = b.substring(0, a) + String.fromCharCode(e)
+ b.substring(c + 1)
}
}
return b.replace(aa, "<").replace(ba, ">").replace(ca, "'").replace(da,
'"').replace(ea, "&").replace(fa, " ")
}
function S(b) {
return "XMP" === b.tagName
}
function z(b, a) {
switch (b.nodeType) {
case 1:
var c = b.tagName.toLowerCase();
a.push("<", c);
for ( var d = 0; d < b.attributes.length; ++d) {
var g = b.attributes[d];
if (!g.specified)
continue;
a.push(" ");
z(g, a)
}
a.push(">");
for ( var e = b.firstChild; e; e = e.nextSibling)
z(e, a);
if (b.firstChild || !/^(?:br|link|img)$/.test(c))
a.push("</", c, ">");
break;
case 2:
a.push(b.name.toLowerCase(), '="', $(b.value), '"');
break;
case 3:
case 4:
a.push(E(b.nodeValue));
break
}
}
var F = null;
function ha(b) {
if (null === F) {
var a = document.createElement("PRE");
a
.appendChild(document
.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));
F = !/</.test(a.innerHTML)
}
if (F) {
var c = b.innerHTML;
if (S(b))
c = E(c);
return c
}
var d = [];
for ( var g = b.firstChild; g; g = g.nextSibling)
z(g, d);
return d.join("")
}
function ia(b) {
var a = 0;
return function(c) {
var d = null, g = 0;
for ( var e = 0, h = c.length; e < h; ++e) {
var f = c.charAt(e);
switch (f) {
case "\t":
if (!d)
d = [];
d.push(c.substring(g, e));
var i = b - a % b;
a += i;
for (; i >= 0; i -= " ".length)
d.push(" ".substring(0, i));
g = e + 1;
break;
case "\n":
a = 0;
break;
default:
++a
}
}
if (!d)
return c;
d.push(c.substring(g));
return d.join("")
}
}
var ja = /(?:[^<]+|<!--[\s\S]*?--\>|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g, ka = /^<!--/, la = /^<\[CDATA\[/, ma = /^<br\b/i;
function na(b) {
var a = b.match(ja), c = [], d = 0, g = [];
if (a)
for ( var e = 0, h = a.length; e < h; ++e) {
var f = a[e];
if (f.length > 1 && f.charAt(0) === "<") {
if (ka.test(f))
continue;
if (la.test(f)) {
c.push(f.substring(9, f.length - 3));
d += f.length - 12
} else if (ma.test(f)) {
c.push("\n");
++d
} else
g.push(d, f)
} else {
var i = ga(f);
c.push(i);
d += i.length
}
}
return {
source : c.join(""),
tags : g
}
}
function v(b, a) {
var c = {};
( function() {
var g = b.concat(a);
for ( var e = g.length; --e >= 0;) {
var h = g[e], f = h[3];
if (f)
for ( var i = f.length; --i >= 0;)
c[f.charAt(i)] = h
}
})();
var d = a.length;
return function(g, e) {
e = e || 0;
var h = [ e, "pln" ], f = "", i = 0, j = g;
while (j.length) {
var o, m = null, k, l = c[j.charAt(0)];
if (l) {
k = j.match(l[1]);
m = k[0];
o = l[0]
} else {
for ( var n = 0; n < d; ++n) {
l = a[n];
var p = l[2];
if (p && !p.test(f))
continue;
k = j.match(l[1]);
if (k) {
m = k[0];
o = l[0];
break
}
}
if (!m) {
o = "pln";
m = j.substring(0, 1)
}
}
h.push(e + i, o);
i += m.length;
j = j.substring(m.length);
if (o !== "com" && /\S/.test(m))
f = m
}
return h
}
}
var oa = v(
[],
[
[ "pln", /^[^<]+/, null ],
[ "dec", /^<!\w[^>]*(?:>|$)/, null ],
[ "com", /^<!--[\s\S]*?(?:--\>|$)/, null ],
[ "src", /^<\?[\s\S]*?(?:\?>|$)/, null ],
[ "src", /^<%[\s\S]*?(?:%>|$)/, null ],
[
"src",
/^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i,
null ], [ "tag", /^<\/?\w[^<>]*>/, null ] ]);
function pa(b) {
var a = oa(b);
for ( var c = 0; c < a.length; c += 2)
if (a[c + 1] === "src") {
var d, g;
d = a[c];
g = c + 2 < a.length ? a[c + 2] : b.length;
var e = b.substring(d, g), h = e
.match(/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/);
if (h)
a.splice(c, 2, d, "tag", d + h[1].length, "src", d
+ h[1].length + (h[2] || "").length, "tag")
}
return a
}
var qa = v( [ [ "atv", /^\'[^\']*(?:\'|$)/, null, "'" ],
[ "atv", /^\"[^\"]*(?:\"|$)/, null, '"' ],
[ "pun", /^[<>\/=]+/, null, "<>/=" ] ], [
[ "tag", /^[\w:\-]+/, /^</ ], [ "atv", /^[\w\-]+/, /^=/ ],
[ "atn", /^[\w:\-]+/, null ], [ "pln", /^\s+/, null, " \t\r\n" ] ]);
function ra(b, a) {
for ( var c = 0; c < a.length; c += 2) {
var d = a[c + 1];
if (d === "tag") {
var g, e;
g = a[c];
e = c + 2 < a.length ? a[c + 2] : b.length;
var h = b.substring(g, e), f = qa(h, g);
u(f, a, c, 2);
c += f.length - 2
}
}
return a
}
function r(b) {
var a = [], c = [];
if (b.tripleQuotedStrings)
a
.push( [
"str",
/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
null, "'\"" ]);
else if (b.multiLineStrings)
a
.push( [
"str",
/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,
null, "'\"`" ]);
else
a
.push( [
"str",
/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,
null, "\"'" ]);
c.push( [ "pln", /^(?:[^\'\"\`\/\#]+)/, null, " \r\n" ]);
if (b.hashComments)
a.push( [ "com", /^#[^\r\n]*/, null, "#" ]);
if (b.cStyleComments)
c.push( [ "com", /^\/\/[^\r\n]*/, null ]);
if (b.regexLiterals)
c
.push( [
"str",
/^\/(?:[^\\\*\/\[]|\\[\s\S]|\[(?:[^\]\\]|\\.)*(?:\]|$))+(?:\/|$)/,
Y ]);
if (b.cStyleComments)
c.push( [ "com", /^\/\*[\s\S]*?(?:\*\/|$)/, null ]);
var d = x(b.keywords);
b = null;
var g = v(a, c), e = v(
[],
[
[ "pln", /^\s+/, null, " \r\n" ],
[ "pln", /^[a-z_$@][a-z_$@0-9]*/i, null ],
[ "lit", /^0x[a-f0-9]+[a-z]/i, null ],
[
"lit",
/^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i,
null, "123456789" ],
[ "pun", /^[^\s\w\.$@]+/, null ] ]);
function h(f, i) {
for ( var j = 0; j < i.length; j += 2) {
var o = i[j + 1];
if (o === "pln") {
var m, k, l, n;
m = i[j];
k = j + 2 < i.length ? i[j + 2] : f.length;
l = f.substring(m, k);
n = e(l, m);
for ( var p = 0, t = n.length; p < t; p += 2) {
var w = n[p + 1];
if (w === "pln") {
var A = n[p], B = p + 2 < t ? n[p + 2] : l.length, s = f
.substring(A, B);
if (s === ".")
n[p + 1] = "pun";
else if (s in d)
n[p + 1] = "kwd";
else if (/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(s))
n[p + 1] = s.charAt(0) === "@" ? "lit" : "typ"
}
}
u(n, i, j, 2);
j += n.length - 2
}
}
return i
}
return function(f) {
var i = g(f);
i = h(f, i);
return i
}
}
var G = r( {
keywords : W,
hashComments : true,
cStyleComments : true,
multiLineStrings : true,
regexLiterals : true
});
function sa(b, a) {
for ( var c = 0; c < a.length; c += 2) {
var d = a[c + 1];
if (d === "src") {
var g, e;
g = a[c];
e = c + 2 < a.length ? a[c + 2] : b.length;
var h = G(b.substring(g, e));
for ( var f = 0, i = h.length; f < i; f += 2)
h[f] += g;
u(h, a, c, 2);
c += h.length - 2
}
}
return a
}
function ta(b, a) {
var c = false;
for ( var d = 0; d < a.length; d += 2) {
var g = a[d + 1], e, h;
if (g === "atn") {
e = a[d];
h = d + 2 < a.length ? a[d + 2] : b.length;
c = /^on|^style$/i.test(b.substring(e, h))
} else if (g === "atv") {
if (c) {
e = a[d];
h = d + 2 < a.length ? a[d + 2] : b.length;
var f = b.substring(e, h), i = f.length, j = i >= 2
&& /^[\"\']/.test(f)
&& f.charAt(0) === f.charAt(i - 1), o, m, k;
if (j) {
m = e + 1;
k = h - 1;
o = f
} else {
m = e + 1;
k = h - 1;
o = f.substring(1, f.length - 1)
}
var l = G(o);
for ( var n = 0, p = l.length; n < p; n += 2)
l[n] += m;
if (j) {
l.push(k, "atv");
u(l, a, d + 2, 0)
} else
u(l, a, d, 2)
}
c = false
}
}
return a
}
function ua(b) {
var a = pa(b);
a = ra(b, a);
a = sa(b, a);
a = ta(b, a);
return a
}
function va(b, a, c) {
var d = [], g = 0, e = null, h = null, f = 0, i = 0, j = ia(8);
function o(k) {
if (k > g) {
if (e && e !== h) {
d.push("</span>");
e = null
}
if (!e && h) {
e = h;
d.push('<span class="', e, '">')
}
var l = E(j(b.substring(g, k))).replace(/(\r\n?|\n| ) /g,
"$1&nbsp;").replace(/\r\n?|\n/g, "<br />");
d.push(l);
g = k
}
}
while (true) {
var m;
m = f < a.length ? (i < c.length ? a[f] <= c[i] : true) : false;
if (m) {
o(a[f]);
if (e) {
d.push("</span>");
e = null
}
d.push(a[f + 1]);
f += 2
} else if (i < c.length) {
o(c[i]);
h = c[i + 1];
i += 2
} else
break
}
o(b.length);
if (e)
d.push("</span>");
return d.join("")
}
var C = {};
function q(b, a) {
for ( var c = a.length; --c >= 0;) {
var d = a[c];
if (!C.hasOwnProperty(d))
C[d] = b;
else if ("console" in window)
console.log("cannot override language handler %s", d)
}
}
q(G, [ "default-code" ]);
q(ua, [ "default-markup", "html", "htm", "xhtml", "xml", "xsl" ]);
q(r( {
keywords : I,
hashComments : true,
cStyleComments : true
}), [ "c", "cc", "cpp", "cs", "cxx", "cyc" ]);
q(r( {
keywords : J,
cStyleComments : true
}), [ "java" ]);
q(r( {
keywords : O,
hashComments : true,
multiLineStrings : true
}), [ "bsh", "csh", "sh" ]);
q(r( {
keywords : M,
hashComments : true,
multiLineStrings : true,
tripleQuotedStrings : true
}), [ "cv", "py" ]);
q(r( {
keywords : L,
hashComments : true,
multiLineStrings : true,
regexLiterals : true
}), [ "perl", "pl", "pm" ]);
q(r( {
keywords : N,
hashComments : true,
multiLineStrings : true,
regexLiterals : true
}), [ "rb" ]);
q(r( {
keywords : K,
cStyleComments : true,
regexLiterals : true
}), [ "js" ]);
function T(b, a) {
try {
var c = na(b), d = c.source, g = c.tags;
if (!C.hasOwnProperty(a))
a = /^\s*</.test(d) ? "default-markup" : "default-code";
var e = C[a].call( {}, d);
return va(d, g, e)
} catch (h) {
if ("console" in window) {
console.log(h);
console.trace()
}
return b
}
}
function wa(b) {
var a = H(), c = [ document.getElementsByTagName("pre"),
document.getElementsByTagName("code"),document.getElementsByTagName("li"),
document.getElementsByTagName("xmp") ], d = [];
for ( var g = 0; g < c.length; ++g)
for ( var e = 0; e < c[g].length; ++e)
d.push(c[g][e]);
c = null;
var h = 0;
function f() {
var i = (new Date).getTime() + 250;
for (; h < d.length && (new Date).getTime() < i; h++) {
var j = d[h];
if (j.className && j.className.indexOf("prettyprint") >= 0) {
var o = j.className.match(/\blang-(\w+)\b/);
if (o)
o = o[1];
var m = false;
for ( var k = j.parentNode; k; k = k.parentNode)
if ((k.tagName === "pre" || k.tagName === "code" || k.tagName === "xmp")
&& k.className
&& k.className.indexOf("prettyprint") >= 0) {
m = true;
break
}
if (!m) {
var l = ha(j);
l = l.replace(/(?:\r\n?|\n)$/, "");
var n = T(l, o);
if (!S(j))
j.innerHTML = n;
else {
var p = document.createElement("PRE");
for ( var t = 0; t < j.attributes.length; ++t) {
var w = j.attributes[t];
if (w.specified)
p.setAttribute(w.name, w.value)
}
p.innerHTML = n;
j.parentNode.replaceChild(p, j);
p = j
}
if (a && j.tagName === "PRE") {
var A = j.getElementsByTagName("br");
for ( var B = A.length; --B >= 0;) {
var s = A[B];
s.parentNode.replaceChild(document
.createTextNode("\r\n"), s)
}
}
}
}
}
if (h < d.length)
setTimeout(f, 250);
else if (b)
b()
}
f()
}
window.PR_normalizedHtml = z;
window.prettyPrintOne = T;
window.prettyPrint = wa;
window.PR = {
createSimpleLexer : v,
registerLangHandler : q,
sourceDecorator : r,
PR_ATTRIB_NAME : "atn",
PR_ATTRIB_VALUE : "atv",
PR_COMMENT : "com",
PR_DECLARATION : "dec",
PR_KEYWORD : "kwd",
PR_LITERAL : "lit",
PR_PLAIN : "pln",
PR_PUNCTUATION : "pun",
PR_SOURCE : "src",
PR_STRING : "str",
PR_TAG : "tag",
PR_TYPE : "typ"
}
})();

View file

@ -0,0 +1,483 @@
/*
Copyright (c) 2009-2010 Scott Graham
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Portions of the code were written with the benefit of viewing code that's in
the official "CPython" distribution and/or translated from code that's in the
official "CPython" distribution. As such, they are:
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software
Foundation; All Rights Reserved"
per:
http://www.python.org/psf/license/
http://www.python.org/download/releases/2.6.2/license/
*/
(function(){var COMPILED=true,goog=goog||{};goog.global=this;goog.DEBUG=false;goog.LOCALE="en";goog.evalWorksForGlobals_=null;goog.provide=function(a){if(!COMPILED){if(goog.getObjectByName(a)&&!goog.implicitNamespaces_[a])throw Error('Namespace "'+a+'" already declared.');for(var b=a;b=b.substring(0,b.lastIndexOf("."));)goog.implicitNamespaces_[b]=true}goog.exportPath_(a)};if(!COMPILED)goog.implicitNamespaces_={};
goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;!(a[0]in c)&&c.execScript&&c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)if(!a.length&&goog.isDef(b))c[d]=b;else c=c[d]?c[d]:c[d]={}};goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(d[e])d=d[e];else return null;return d};goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};
goog.addDependency=function(a,b,c){if(!COMPILED){var d;a=a.replace(/\\/g,"/");for(var e=goog.dependencies_,f=0;d=b[f];f++){e.nameToPath[d]=a;a in e.pathToNames||(e.pathToNames[a]={});e.pathToNames[a][d]=true}for(d=0;b=c[d];d++){a in e.requires||(e.requires[a]={});e.requires[a][b]=true}}};
goog.require=function(a){if(!COMPILED)if(!goog.getObjectByName(a)){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=true;goog.writeScripts_()}else{a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");};
goog.addSingletonGetter=function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}};
if(!COMPILED){goog.included_={};goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}};goog.inHtmlDocument_=function(){var a=goog.global.document;return typeof a!="undefined"&&"write"in a};goog.findBasePath_=function(){if(goog.inHtmlDocument_()){var a=goog.global.document;if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else{a=a.getElementsByTagName("script");for(var b=a.length-1;b>=0;--b){var c=a[b].src,d=c.length;if(c.substr(d-7)=="base.js"){goog.basePath=
c.substr(0,d-7);break}}}}};goog.writeScriptTag_=function(a){if(goog.inHtmlDocument_()&&!goog.dependencies_.written[a]){goog.dependencies_.written[a]=true;goog.global.document.write('<script type="text/javascript" src="'+a+'"><\/script>')}};goog.writeScripts_=function(){function a(f){if(!(f in d.written)){if(!(f in d.visited)){d.visited[f]=true;if(f in d.requires)for(var g in d.requires[f])if(g in d.nameToPath)a(d.nameToPath[g]);else if(!goog.getObjectByName(g))throw Error("Undefined nameToPath for "+
g);}if(!(f in c)){c[f]=true;b.push(f)}}}var b=[],c={},d=goog.dependencies_,e;for(e in goog.included_)d.written[e]||a(e);for(e=0;e<b.length;e++)if(b[e])goog.writeScriptTag_(goog.basePath+b[e]);else throw Error("Undefined script input");};goog.getPathFromDeps_=function(a){return a in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null};goog.findBasePath_();goog.global.CLOSURE_NO_DEPS||goog.writeScriptTag_(goog.basePath+"deps.js")}
goog.typeOf=function(a){var b=typeof a;if(b=="object")if(a){if(a instanceof Array||!(a instanceof Object)&&Object.prototype.toString.call(a)=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(!(a instanceof Object)&&(Object.prototype.toString.call(a)=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call")))return"function"}else return"null";
else if(b=="function"&&typeof a.call=="undefined")return"object";return b};goog.propertyIsEnumerableCustom_=function(a,b){if(b in a)for(var c in a)if(c==b&&Object.prototype.hasOwnProperty.call(a,b))return true;return false};goog.propertyIsEnumerable_=function(a,b){return a instanceof Object?Object.prototype.propertyIsEnumerable.call(a,b):goog.propertyIsEnumerableCustom_(a,b)};goog.isDef=function(a){return a!==undefined};goog.isNull=function(a){return a===null};
goog.isDefAndNotNull=function(a){return a!=null};goog.isArray=function(a){return goog.typeOf(a)=="array"};goog.isArrayLike=function(a){var b=goog.typeOf(a);return b=="array"||b=="object"&&typeof a.length=="number"};goog.isDateLike=function(a){return goog.isObject(a)&&typeof a.getFullYear=="function"};goog.isString=function(a){return typeof a=="string"};goog.isBoolean=function(a){return typeof a=="boolean"};goog.isNumber=function(a){return typeof a=="number"};
goog.isFunction=function(a){return goog.typeOf(a)=="function"};goog.isObject=function(a){a=goog.typeOf(a);return a=="object"||a=="array"||a=="function"};goog.getUid=function(a){if(a.hasOwnProperty&&a.hasOwnProperty(goog.UID_PROPERTY_))return a[goog.UID_PROPERTY_];a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_);return a[goog.UID_PROPERTY_]};goog.removeUid=function(a){"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};
goog.UID_PROPERTY_="closure_uid_"+Math.floor(Math.random()*2147483648).toString(36);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if(b=="object"||b=="array"){if(a.clone)return a.clone();b=b=="array"?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b}return a};
goog.bind=function(a,b){var c=b||goog.global;if(arguments.length>2){var d=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(e,d);return a.apply(c,e)}}else return function(){return a.apply(c,arguments)}};goog.partial=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){var c=Array.prototype.slice.call(arguments);c.unshift.apply(c,b);return a.apply(this,c)}};
goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=Date.now||function(){return+new Date};
goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval){if(goog.evalWorksForGlobals_==null){goog.global.eval("var _et_ = 1;");if(typeof goog.global._et_!="undefined"){delete goog.global._et_;goog.evalWorksForGlobals_=true}else goog.evalWorksForGlobals_=false}if(goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.defer=false;c.appendChild(b.createTextNode(a));
b.body.appendChild(c);b.body.removeChild(c)}}else throw Error("goog.globalEval not available");};goog.typedef=true;goog.getCssName=function(a,b){var c=a+(b?"-"+b:"");return goog.cssNameMapping_&&c in goog.cssNameMapping_?goog.cssNameMapping_[c]:c};goog.setCssNameMapping=function(a){goog.cssNameMapping_=a};goog.getMsg=function(a,b){var c=b||{},d;for(d in c){var e=(""+c[d]).replace(/\$/g,"$$$$");a=a.replace(RegExp("\\{\\$"+d+"\\}","gi"),e)}return a};
goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};goog.exportProperty=function(a,b,c){a[b]=c};goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};
goog.base=function(a,b){var c=arguments.callee.caller;if(c.superClass_)return c.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var d=Array.prototype.slice.call(arguments,2),e=false,f=a.constructor;f;f=f.superClass_&&f.superClass_.constructor)if(f.prototype[b]===c)e=true;else if(e)return f.prototype[b].apply(a,d);if(a[b]===c)return a.constructor.prototype[b].apply(a,d);else throw Error("goog.base called from a method of one name to a method of a different name");};
goog.scope=function(a){a.call(goog.global)};goog.string={};goog.string.Unicode={NBSP:"\u00a0"};goog.string.startsWith=function(a,b){return a.lastIndexOf(b,0)==0};goog.string.endsWith=function(a,b){var c=a.length-b.length;return c>=0&&a.indexOf(b,c)==c};goog.string.caseInsensitiveStartsWith=function(a,b){return goog.string.caseInsensitiveCompare(b,a.substr(0,b.length))==0};goog.string.caseInsensitiveEndsWith=function(a,b){return goog.string.caseInsensitiveCompare(b,a.substr(a.length-b.length,b.length))==0};
goog.string.subs=function(a){for(var b=1;b<arguments.length;b++){var c=String(arguments[b]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,c)}return a};goog.string.collapseWhitespace=function(a){return a.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")};goog.string.isEmpty=function(a){return/^[\s\xa0]*$/.test(a)};goog.string.isEmptySafe=function(a){return goog.string.isEmpty(goog.string.makeSafe(a))};goog.string.isBreakingWhitespace=function(a){return!/[^\t\n\r ]/.test(a)};goog.string.isAlpha=function(a){return!/[^a-zA-Z]/.test(a)};
goog.string.isNumeric=function(a){return!/[^0-9]/.test(a)};goog.string.isAlphaNumeric=function(a){return!/[^a-zA-Z0-9]/.test(a)};goog.string.isSpace=function(a){return a==" "};goog.string.isUnicodeChar=function(a){return a.length==1&&a>=" "&&a<="~"||a>="\u0080"&&a<="\ufffd"};goog.string.stripNewlines=function(a){return a.replace(/(\r\n|\r|\n)+/g," ")};goog.string.canonicalizeNewlines=function(a){return a.replace(/(\r\n|\r|\n)/g,"\n")};
goog.string.normalizeWhitespace=function(a){return a.replace(/\xa0|\s/g," ")};goog.string.normalizeSpaces=function(a){return a.replace(/\xa0|[ \t]+/g," ")};goog.string.trim=function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};goog.string.trimLeft=function(a){return a.replace(/^[\s\xa0]+/,"")};goog.string.trimRight=function(a){return a.replace(/[\s\xa0]+$/,"")};goog.string.caseInsensitiveCompare=function(a,b){var c=String(a).toLowerCase(),d=String(b).toLowerCase();return c<d?-1:c==d?0:1};
goog.string.numerateCompareRegExp_=/(\.\d+)|(\d+)|(\D+)/g;goog.string.numerateCompare=function(a,b){if(a==b)return 0;if(!a)return-1;if(!b)return 1;for(var c=a.toLowerCase().match(goog.string.numerateCompareRegExp_),d=b.toLowerCase().match(goog.string.numerateCompareRegExp_),e=Math.min(c.length,d.length),f=0;f<e;f++){var g=c[f],h=d[f];if(g!=h){c=parseInt(g,10);if(!isNaN(c)){d=parseInt(h,10);if(!isNaN(d)&&c-d)return c-d}return g<h?-1:1}}if(c.length!=d.length)return c.length-d.length;return a<b?-1:1};
goog.string.encodeUriRegExp_=/^[a-zA-Z0-9\-_.!~*'()]*$/;goog.string.urlEncode=function(a){a=String(a);if(!goog.string.encodeUriRegExp_.test(a))return encodeURIComponent(a);return a};goog.string.urlDecode=function(a){return decodeURIComponent(a.replace(/\+/g," "))};goog.string.newLineToBr=function(a,b){return a.replace(/(\r\n|\r|\n)/g,b?"<br />":"<br>")};
goog.string.htmlEscape=function(a,b){if(b)return a.replace(goog.string.amperRe_,"&amp;").replace(goog.string.ltRe_,"&lt;").replace(goog.string.gtRe_,"&gt;").replace(goog.string.quotRe_,"&quot;");else{if(!goog.string.allRe_.test(a))return a;if(a.indexOf("&")!=-1)a=a.replace(goog.string.amperRe_,"&amp;");if(a.indexOf("<")!=-1)a=a.replace(goog.string.ltRe_,"&lt;");if(a.indexOf(">")!=-1)a=a.replace(goog.string.gtRe_,"&gt;");if(a.indexOf('"')!=-1)a=a.replace(goog.string.quotRe_,"&quot;");return a}};
goog.string.amperRe_=/&/g;goog.string.ltRe_=/</g;goog.string.gtRe_=/>/g;goog.string.quotRe_=/\"/g;goog.string.allRe_=/[&<>\"]/;goog.string.unescapeEntities=function(a){if(goog.string.contains(a,"&"))return"document"in goog.global&&!goog.string.contains(a,"<")?goog.string.unescapeEntitiesUsingDom_(a):goog.string.unescapePureXmlEntities_(a);return a};
goog.string.unescapeEntitiesUsingDom_=function(a){var b=goog.global.document.createElement("a");b.innerHTML=a;b[goog.string.NORMALIZE_FN_]&&b[goog.string.NORMALIZE_FN_]();a=b.firstChild.nodeValue;b.innerHTML="";return a};goog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(b,c){switch(c){case "amp":return"&";case "lt":return"<";case "gt":return">";case "quot":return'"';default:if(c.charAt(0)=="#"){var d=Number("0"+c.substr(1));if(!isNaN(d))return String.fromCharCode(d)}return b}})};
goog.string.NORMALIZE_FN_="normalize";goog.string.whitespaceEscape=function(a,b){return goog.string.newLineToBr(a.replace(/ /g," &#160;"),b)};goog.string.stripQuotes=function(a,b){for(var c=b.length,d=0;d<c;d++){var e=c==1?b:b.charAt(d);if(a.charAt(0)==e&&a.charAt(a.length-1)==e)return a.substring(1,a.length-1)}return a};goog.string.truncate=function(a,b,c){if(c)a=goog.string.unescapeEntities(a);if(a.length>b)a=a.substring(0,b-3)+"...";if(c)a=goog.string.htmlEscape(a);return a};
goog.string.truncateMiddle=function(a,b,c){if(c)a=goog.string.unescapeEntities(a);if(a.length>b){var d=Math.floor(b/2),e=a.length-d;d+=b%2;a=a.substring(0,d)+"..."+a.substring(e)}if(c)a=goog.string.htmlEscape(a);return a};goog.string.specialEscapeChars_={"\u0000":"\\0","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\u000b":"\\x0B",'"':'\\"',"\\":"\\\\"};goog.string.jsEscapeCache_={"'":"\\'"};
goog.string.quote=function(a){a=String(a);if(a.quote)return a.quote();else{for(var b=['"'],c=0;c<a.length;c++){var d=a.charAt(c),e=d.charCodeAt(0);b[c+1]=goog.string.specialEscapeChars_[d]||(e>31&&e<127?d:goog.string.escapeChar(d))}b.push('"');return b.join("")}};goog.string.escapeString=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=goog.string.escapeChar(a.charAt(c));return b.join("")};
goog.string.escapeChar=function(a){if(a in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[a];if(a in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[a]=goog.string.specialEscapeChars_[a];var b=a,c=a.charCodeAt(0);if(c>31&&c<127)b=a;else{if(c<256){b="\\x";if(c<16||c>256)b+="0"}else{b="\\u";if(c<4096)b+="0"}b+=c.toString(16).toUpperCase()}return goog.string.jsEscapeCache_[a]=b};goog.string.toMap=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=true;return b};
goog.string.contains=function(a,b){return a.indexOf(b)!=-1};goog.string.removeAt=function(a,b,c){var d=a;if(b>=0&&b<a.length&&c>0)d=a.substr(0,b)+a.substr(b+c,a.length-b-c);return d};goog.string.remove=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"");return a.replace(c,"")};goog.string.removeAll=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"g");return a.replace(c,"")};
goog.string.regExpEscape=function(a){return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")};goog.string.repeat=function(a,b){return Array(b+1).join(a)};goog.string.padNumber=function(a,b,c){a=goog.isDef(c)?a.toFixed(c):String(a);c=a.indexOf(".");if(c==-1)c=a.length;return goog.string.repeat("0",Math.max(0,b-c))+a};goog.string.makeSafe=function(a){return a==null?"":String(a)};goog.string.buildString=function(){return Array.prototype.join.call(arguments,"")};
goog.string.getRandomString=function(){return Math.floor(Math.random()*2147483648).toString(36)+(Math.floor(Math.random()*2147483648)^goog.now()).toString(36)};
goog.string.compareVersions=function(a,b){for(var c=0,d=goog.string.trim(String(a)).split("."),e=goog.string.trim(String(b)).split("."),f=Math.max(d.length,e.length),g=0;c==0&&g<f;g++){var h=d[g]||"",i=e[g]||"",j=RegExp("(\\d*)(\\D*)","g"),k=RegExp("(\\d*)(\\D*)","g");do{var l=j.exec(h)||["","",""],n=k.exec(i)||["","",""];if(l[0].length==0&&n[0].length==0)break;c=l[1].length==0?0:parseInt(l[1],10);var p=n[1].length==0?0:parseInt(n[1],10);c=goog.string.compareElements_(c,p)||goog.string.compareElements_(l[2].length==
0,n[2].length==0)||goog.string.compareElements_(l[2],n[2])}while(c==0)}return c};goog.string.compareElements_=function(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};goog.string.HASHCODE_MAX_=4294967296;goog.string.hashCode=function(a){for(var b=0,c=0;c<a.length;++c){b=31*b+a.charCodeAt(c);b%=goog.string.HASHCODE_MAX_}return b};goog.string.uniqueStringCounter_=Math.random()*2147483648|0;goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++};
goog.string.toNumber=function(a){var b=Number(a);if(b==0&&goog.string.isEmpty(a))return NaN;return b};goog.debug={};goog.debug.Error=function(a){this.stack=Error().stack||"";if(a)this.message=String(a)};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name="CustomError";goog.asserts={};goog.asserts.ENABLE_ASSERTS=goog.DEBUG;goog.asserts.AssertionError=function(a,b){b.unshift(a);goog.debug.Error.call(this,goog.string.subs.apply(null,b));b.shift();this.messagePattern=a};goog.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name="AssertionError";goog.asserts.doAssertFailure_=function(a,b,c,d){var e="Assertion failed";if(c){e+=": "+c;var f=d}else if(a){e+=": "+a;f=b}throw new goog.asserts.AssertionError(""+e,f||[]);};
goog.asserts.assert=function(a,b){goog.asserts.ENABLE_ASSERTS&&!a&&goog.asserts.doAssertFailure_("",null,b,Array.prototype.slice.call(arguments,2))};goog.asserts.fail=function(a){if(goog.asserts.ENABLE_ASSERTS)throw new goog.asserts.AssertionError("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};
goog.asserts.assertNumber=function(a,b){goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(a)&&goog.asserts.doAssertFailure_("Expected number but got %s.",[a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertString=function(a,b){goog.asserts.ENABLE_ASSERTS&&!goog.isString(a)&&goog.asserts.doAssertFailure_("Expected string but got %s.",[a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertFunction=function(a,b){goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(a)&&goog.asserts.doAssertFailure_("Expected function but got %s.",[a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertObject=function(a,b){goog.asserts.ENABLE_ASSERTS&&!goog.isObject(a)&&goog.asserts.doAssertFailure_("Expected object but got %s.",[a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertArray=function(a,b){goog.asserts.ENABLE_ASSERTS&&!goog.isArray(a)&&goog.asserts.doAssertFailure_("Expected array but got %s.",[a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertInstanceof=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!(a instanceof b)&&goog.asserts.doAssertFailure_("instanceof check failed.",null,c,Array.prototype.slice.call(arguments,3))};var Sk=Sk||{};Sk.configure=function(a){Sk.output=a.output||Sk.output;goog.asserts.assert(typeof Sk.output==="function");Sk.debugout=a.debugout||Sk.debugout;goog.asserts.assert(typeof Sk.debugout==="function");Sk.read=a.read||Sk.read;goog.asserts.assert(typeof Sk.read==="function");Sk.sysargv=a.sysargv||Sk.sysargv;goog.asserts.assert(goog.isArrayLike(Sk.sysargv));if(a.syspath){Sk.syspath=a.syspath;goog.asserts.assert(goog.isArrayLike(Sk.syspath));Sk.realsyspath=undefined;Sk.sysmodules=new Sk.builtin.dict([])}};
goog.exportSymbol("Sk.configure",Sk.configure);Sk.output=function(){};Sk.read=function(){throw"Sk.read has not been implemented";};Sk.sysargv=[];Sk.getSysArgv=function(){return Sk.sysargv};goog.exportSymbol("Sk.getSysArgv",Sk.getSysArgv);Sk.syspath=[];Sk.inBrowser=goog.global.document!==undefined;Sk.debugout=function(){};
(function(){if(goog.global.write!==undefined)Sk.output=goog.global.write;else if(goog.global.console!==undefined&&goog.global.console.log!==undefined)Sk.output=function(a){goog.global.console.log(a)};else if(goog.global.print!==undefined)Sk.output=goog.global.print;if(goog.global.print!==undefined)Sk.debugout=goog.global.print})();
if(!Sk.inBrowser)goog.writeScriptTag_=function(a){if(!goog.dependencies_.written[a]){goog.dependencies_.written[a]=true;goog.global.eval(goog.global.read("support/closure-library/closure/goog/"+a))}};Sk.builtin={};Sk.builtin.range=function(a,b,c){var d=[];(new Sk.builtin.slice(a,b,c)).sssiter$(0,function(e){d.push(e)});return new Sk.builtin.list(d)};Sk.builtin.len=function(a){if(a.sq$length)return a.sq$length();if(a.mp$length)return a.mp$length();throw new Sk.builtin.TypeError("object of type '"+a.tp$name+"' has no len()");};Sk.builtin.min=function(){for(var a=arguments[0],b=1;b<arguments.length;++b)if(arguments[b]<a)a=arguments[b];return a};
Sk.builtin.max=function(){for(var a=arguments[0],b=1;b<arguments.length;++b)if(arguments[b]>a)a=arguments[b];return a};Sk.builtin.abs=function(a){return Math.abs(a)};Sk.builtin.ord=function(a){if(a.constructor!==Sk.builtin.str||a.v.length!==1)throw"ord() expected string of length 1";return a.v.charCodeAt(0)};Sk.builtin.chr=function(a){if(typeof a!=="number")throw"TypeError: an integer is required";return new Sk.builtin.str(String.fromCharCode(a))};
Sk.builtin.dir=function(a){var b=[],c;for(c in a.constructor.prototype){var d;if(c.indexOf("$")!==-1)d=Sk.builtin.dir.slotNameToRichName(c);else if(c.charAt(c.length-1)!=="_")d=c;d&&b.push(new Sk.builtin.str(d))}b.sort(function(e,f){return(e.v>f.v)-(e.v<f.v)});return new Sk.builtin.list(b)};Sk.builtin.dir.slotNameToRichName=function(){};Sk.builtin.repr=function(a){return Sk.misceval.objectRepr(a)};
Sk.builtin.open=function(a,b,c){if(b===undefined)b="r";if(b!=="r"&&b!=="rb")throw"todo; haven't implemented non-read opens";return new Sk.builtin.file(a,b,c)};
Sk.builtin.isinstance=function(a,b){if(a.ob$type===b)return true;if(b instanceof Sk.builtin.tuple){for(var c=0;c<b.v.length;++c)if(Sk.builtin.isinstance(a,b.v[c]))return true;return false}var d=function(e,f){if(e===f)return true;if(e.$d===undefined)return false;for(var g=e.$d.mp$subscript(Sk.builtin.type.basesStr_),h=0;h<g.v.length;++h)if(d(g.v[h],f))return true;return false};return d(a.ob$type,b)};Sk.builtin.hashCount=0;
Sk.builtin.hash=function(a){if(a instanceof Object&&a.tp$hash!==undefined){if(a.$savedHash_)return a.$savedHash_;a.$savedHash_="custom "+a.tp$hash();return a.$savedHash_}if(a instanceof Object){if(a.__id===undefined){Sk.builtin.hashCount+=1;a.__id="object "+Sk.builtin.hashCount}return a.__id}return typeof a+" "+String(a)};Sk.builtin.getattr=function(a,b,c){a=a.tp$getattr(b.v);if(a===undefined)return c;return a};Sk.builtin.Exception=function(a){a=Array.prototype.slice.call(arguments);for(var b=0;b<a.length;++b)if(typeof a[b]==="string")a[b]=new Sk.builtin.str(a[b]);this.args=new Sk.builtin.tuple(a)};Sk.builtin.Exception.prototype.tp$name="Exception";
Sk.builtin.Exception.prototype.tp$str=function(){var a="";if(this.args.v.length>1){a='File "'+this.args.v[1].v+'", line '+this.args.v[2]+"\n"+this.args.v[4].v+"\n";for(var b=0;b<this.args.v[3];++b)a+=" ";a+="^\n"}a+=this.tp$name;if(this.args)a+=": "+this.args.v[0].v;return new Sk.builtin.str(a)};Sk.builtin.Exception.prototype.toString=function(){return this.tp$str().v};Sk.builtin.AssertionError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.AssertionError,Sk.builtin.Exception);
Sk.builtin.AssertionError.prototype.tp$name="AssertionError";Sk.builtin.AttributeError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.AttributeError,Sk.builtin.Exception);Sk.builtin.AttributeError.prototype.tp$name="AttributeError";Sk.builtin.ImportError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ImportError,Sk.builtin.Exception);Sk.builtin.ImportError.prototype.tp$name="ImportError";
Sk.builtin.IndentationError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.IndentationError,Sk.builtin.Exception);Sk.builtin.IndentationError.prototype.tp$name="IndentationError";Sk.builtin.IndexError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.IndexError,Sk.builtin.Exception);Sk.builtin.IndexError.prototype.tp$name="IndexError";Sk.builtin.NameError=function(){Sk.builtin.Exception.apply(this,arguments)};
goog.inherits(Sk.builtin.NameError,Sk.builtin.Exception);Sk.builtin.NameError.prototype.tp$name="NameError";Sk.builtin.ParseError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ParseError,Sk.builtin.Exception);Sk.builtin.ParseError.prototype.tp$name="ParseError";Sk.builtin.SyntaxError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.SyntaxError,Sk.builtin.Exception);Sk.builtin.SyntaxError.prototype.tp$name="SyntaxError";
Sk.builtin.TokenError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.TokenError,Sk.builtin.Exception);Sk.builtin.TokenError.prototype.tp$name="TokenError";Sk.builtin.TypeError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.TypeError,Sk.builtin.Exception);Sk.builtin.TypeError.prototype.tp$name="TypeError";Sk.builtin.ValueError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ValueError,Sk.builtin.Exception);
Sk.builtin.ValueError.prototype.tp$name="ValueError";Sk.builtin.ZeroDivisionError=function(){Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ZeroDivisionError,Sk.builtin.Exception);Sk.builtin.ZeroDivisionError.prototype.tp$name="ZeroDivisionError";Sk.builtin.type=function(a,b,c){if(b===undefined&&c===undefined){if(a===true||a===false)return Sk.builtin.BoolObj.prototype.ob$type;if(a===null)return Sk.builtin.NoneObj.prototype.ob$type;if(typeof a==="number")return Math.floor(a)===a?Sk.builtin.IntObj.prototype.ob$type:Sk.builtin.FloatObj.prototype.ob$type;return a.ob$type}else{var d=function(f){if(!(this instanceof d))return new d(Array.prototype.slice.call(arguments,0));f=f||[];goog.asserts.assert(Sk.builtin.dict!==undefined);this.$d=new Sk.builtin.dict([]);
var g=Sk.builtin.type.typeLookup(this.ob$type,"__init__");if(g!==undefined){f.unshift(this);Sk.misceval.apply(g,undefined,f)}return this},e;for(e in c){d.prototype[e]=c[e];d[e]=c[e]}d.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;d.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;d.prototype.tp$descr_get=function(){goog.asserts.fail("in type tp$descr_get")};d.prototype.$r=function(){var f=this.tp$getattr("__repr__");if(f!==undefined)return Sk.misceval.apply(f,undefined,
[]);f=c.__module__;var g="";if(f)g=f.v+".";return new Sk.builtin.str("<"+g+a+" object>")};d.prototype.tp$call=function(f,g){var h=this.tp$getattr("__call__");if(h)return Sk.misceval.apply(h,g,f);throw new Sk.builtin.TypeError("'"+this.tp$name+"' object is not callable");};d.prototype.tp$iter=function(){var f=this.tp$getattr("__iter__");if(f){f=Sk.misceval.call(f);if(f.tp$getattr("next")===undefined)throw new Sk.builtin.TypeError("iter() return non-iterator of type '"+this.tp$name+"'");return f}throw new Sk.builtin.TypeError("'"+
this.tp$name+"' object is not iterable");};d.prototype.tp$iternext=function(){var f=this.tp$getattr("next");goog.asserts.assert(f!==undefined,"iter() should have caught this");return Sk.misceval.call(f)};d.tp$name=a;if(b){d.$d=new Sk.builtin.dict([]);d.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,new Sk.builtin.tuple(b));b=Sk.builtin.type.buildMRO(d);d.$d.mp$ass_subscript(Sk.builtin.type.mroStr_,b);d.tp$mro=b}d.tp$getattr=Sk.builtin.type.prototype.tp$getattr;d.ob$type=Sk.builtin.type;d.prototype.ob$type=
d;Sk.builtin.type.makeIntoTypeObj(a,d);return d}};Sk.builtin.type.makeTypeObj=function(a,b){Sk.builtin.type.makeIntoTypeObj(a,b);return b};
Sk.builtin.type.makeIntoTypeObj=function(a,b){goog.asserts.assert(a!==undefined);goog.asserts.assert(b!==undefined);b.ob$type=Sk.builtin.type;b.tp$name=a;b.$r=function(){var c=b.__module__,d="";if(c)d=c.v+".";return new Sk.builtin.str("<class '"+d+b.tp$name+"'>")};b.tp$str=undefined;b.tp$getattr=Sk.builtin.type.prototype.tp$getattr;b.tp$setattr=Sk.builtin.type.prototype.tp$setattr;return b};Sk.builtin.type.ob$type=Sk.builtin.type;Sk.builtin.type.tp$name="type";Sk.builtin.type.$r=function(){return new Sk.builtin.str("<type 'type'>")};
Sk.builtin.type.prototype.tp$getattr=function(a){var b=Sk.builtin.type.typeLookup(this,a),c;if(b!==undefined&&b.ob$type!==undefined)c=b.ob$type.tp$descr_get;if(this.$d){a=this.$d.mp$subscript(new Sk.builtin.str(a));if(a!==undefined)return a}if(c)return c.call(b,null,this);if(b)return b};Sk.builtin.type.typeLookup=function(a,b){var c=a.tp$mro;if(!c)return a.prototype[b];for(var d=0;d<c.v.length;++d){var e=c.v[d];if(e.hasOwnProperty(b))return e[b];e=e.$d.mp$subscript(new Sk.builtin.str(b));if(e!==undefined)return e}};
Sk.builtin.type.mroMerge_=function(a){for(var b=[];;){for(var c=0;c<a.length;++c){var d=a[c];if(d.length!==0)break}if(c===a.length)return b;var e=[];for(c=0;c<a.length;++c){d=a[c];if(d.length!==0){d=d[0];var f=0;a:for(;f<a.length;++f)for(var g=a[f],h=1;h<g.length;++h)if(g[h]===d)break a;f===a.length&&e.push(d)}}if(e.length===0)throw new TypeError("Inconsistent precedences in type hierarchy");e=e[0];b.push(e);for(c=0;c<a.length;++c){d=a[c];d.length>0&&d[0]===e&&d.splice(0,1)}}};
Sk.builtin.type.buildMRO_=function(a){var b=[[a]];a=a.$d.mp$subscript(Sk.builtin.type.basesStr_);for(var c=0;c<a.v.length;++c)b.push(Sk.builtin.type.buildMRO_(a.v[c]));var d=[];for(c=0;c<a.v.length;++c)d.push(a.v[c]);b.push(d);return Sk.builtin.type.mroMerge_(b)};Sk.builtin.type.buildMRO=function(a){return new Sk.builtin.tuple(Sk.builtin.type.buildMRO_(a))};Sk.builtin.func=function(a,b,c,d){this.func_code=a;this.func_globals=b||null;if(d!==undefined)for(var e in d)c[e]=d[e];this.func_closure=c;return this};goog.exportSymbol("Sk.builtin.func",Sk.builtin.func);Sk.builtin.func.prototype.tp$name="function";Sk.builtin.func.prototype.tp$descr_get=function(a,b){goog.asserts.assert(a!==undefined&&b!==undefined);if(a==null)return this;return new Sk.builtin.method(this,a)};
Sk.builtin.func.prototype.tp$call=function(a,b){this.func_closure&&a.push(this.func_closure);if(b)for(var c=b.length,d=0;d<c;d+=2){for(var e=this.func_code.co_varnames,f=e.length,g=0;g<f;++g)if(b[d]===e[g])break;a[g]=b[d+1]}return this.func_code.apply(this.func_globals,a)};Sk.builtin.func.prototype.ob$type=Sk.builtin.type.makeTypeObj("function",new Sk.builtin.func(null,null));
Sk.builtin.func.prototype.$r=function(){return new Sk.builtin.str("<function "+(this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||"<native JS>")+">")};Sk.builtin.method=function(a,b){this.im_func=a;this.im_self=b};goog.exportSymbol("Sk.builtin.method",Sk.builtin.method);
Sk.builtin.method.prototype.tp$call=function(a,b){goog.asserts.assert(this.im_self,"should just be a function, not a method since there's no self?");goog.asserts.assert(this.im_func instanceof Sk.builtin.func);a.unshift(this.im_self);if(b)for(var c=b.length,d=0;d<c;d+=2){for(var e=this.im_func.func_code.co_varnames,f=e.length,g=0;g<f;++g)if(b[d]===e[g])break;a[g]=b[d+1]}return this.im_func.func_code.apply(this.im_func.func_globals,a)};
Sk.builtin.method.prototype.$r=function(){return new Sk.builtin.str("<bound method "+this.im_self.ob$type.tp$name+"."+this.im_func.func_code.co_name.v+" of "+this.im_self.$r().v+">")};Sk.builtin.object=function(){if(!(this instanceof Sk.builtin.object))return new Sk.builtin.object;this.$d=new Sk.builtin.dict([]);return this};
Sk.builtin.object.prototype.GenericGetAttr=function(a){goog.asserts.assert(typeof a==="string");var b=this.ob$type;goog.asserts.assert(b!==undefined,"object has no ob$type!");b=Sk.builtin.type.typeLookup(b,a);var c;if(b!==undefined&&b.ob$type!==undefined)c=b.ob$type.tp$descr_get;if(this.$d){var d;if(this.$d.mp$subscript)d=this.$d.mp$subscript(new Sk.builtin.str(a));else if(typeof this.$d==="object")d=this.$d[a];if(d!==undefined)return d}if(c)return c.call(b,this,this.ob$type);if(b)return b};
goog.exportSymbol("Sk.builtin.object.prototype.GenericGetAttr",Sk.builtin.object.prototype.GenericGetAttr);Sk.builtin.object.prototype.GenericSetAttr=function(a,b){goog.asserts.assert(typeof a==="string");if(this.$d.mp$ass_subscript)this.$d.mp$ass_subscript(new Sk.builtin.str(a),b);else if(typeof this.$d==="object")this.$d[a]=b};goog.exportSymbol("Sk.builtin.object.prototype.GenericSetAttr",Sk.builtin.object.prototype.GenericSetAttr);
Sk.builtin.object.prototype.HashNotImplemented=function(){throw new Sk.builtin.TypeError("unhashable type: '"+this.tp$name+"'");};Sk.builtin.object.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.object.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;Sk.builtin.type.makeIntoTypeObj("object",Sk.builtin.object);Sk.builtin.BoolObj=function(){};Sk.builtin.BoolObj.prototype.ob$type=Sk.builtin.type.makeTypeObj("Bool",new Sk.builtin.BoolObj);Sk.builtin.IntObj=function(){};
Sk.builtin.IntObj.prototype.ob$type=Sk.builtin.type.makeTypeObj("int",new Sk.builtin.IntObj);Sk.builtin.FloatObj=function(){};Sk.builtin.FloatObj.prototype.ob$type=Sk.builtin.type.makeTypeObj("float",new Sk.builtin.FloatObj);Sk.builtin.NoneObj=function(){};Sk.builtin.NoneObj.prototype.ob$type=Sk.builtin.type.makeTypeObj("None",new Sk.builtin.NoneObj);Sk.misceval={};Sk.misceval.isIndex=function(a){return a===null||typeof a==="number"||a.constructor===Sk.builtin.lng||a.tp$index};goog.exportSymbol("Sk.misceval.isIndex",Sk.misceval.isIndex);Sk.misceval.asIndex=function(a){if(Sk.misceval.isIndex(a))if(a!==null){if(typeof a==="number")return a;goog.asserts.fail("todo;")}};
Sk.misceval.applySlice=function(a,b,c){if(a.sq$slice&&Sk.misceval.isIndex(b)&&Sk.misceval.isIndex(c)){b=Sk.misceval.asIndex(b);if(b===undefined)b=0;c=Sk.misceval.asIndex(c);if(c===undefined)c=1.0E100;return Sk.abstr.sequenceGetSlice(a,b,c)}return Sk.abstr.objectGetItem(a,new Sk.builtin.slice(b,c,null))};goog.exportSymbol("Sk.misceval.applySlice",Sk.misceval.applySlice);
Sk.misceval.assignSlice=function(a,b,c,d){if(a.sq$ass_slice&&Sk.misceval.isIndex(b)&&Sk.misceval.isIndex(c)){b=Sk.misceval.asIndex(b)||0;c=Sk.misceval.asIndex(c)||1.0E100;d===null?Sk.abstr.sequenceDelSlice(a,b,c):Sk.abstr.sequenceSetSlice(a,b,c,d)}else{c=new Sk.builtin.slice(b,c);return d===null?Sk.abstr.objectDelItem(a,c):Sk.abstr.objectSetItem(a,c,d)}};goog.exportSymbol("Sk.misceval.assignSlice",Sk.misceval.assignSlice);
Sk.misceval.swappedOp_={Eq:"NotEq",NotEq:"Eq",Lt:"Gt",LtE:"GtE",Gt:"Lt",GtE:"LtE",Is:"IsNot",IsNot:"Is",In_:"NotIn",NotIn:"In_"};
Sk.misceval.richCompareBool=function(a,b,c){if(c==="Is")return a===b;if(c==="IsNot")return a!==b;if(a===b)if(c==="Eq")return true;else if(c==="NotEq")return false;if(a instanceof Sk.builtin.str&&b instanceof Sk.builtin.str)if(c==="Eq")return a===b;else if(c==="NotEq")return a!==b;if((typeof a==="number"||typeof a==="boolean")&&(typeof b==="number"||typeof b==="boolean"))switch(c){case "Lt":return a<b;case "LtE":return a<=b;case "Gt":return a>b;case "GtE":return a>=b;case "NotEq":return a!=b;case "Eq":return a==
b;default:throw"assert";}else{if(c==="In")return Sk.abstr.sequenceContains(b,a);if(c==="NotIn")return!Sk.abstr.sequenceContains(b,a);if(a&&a.tp$richcompare)return a.tp$richcompare(b,c);else if(b&&b.tp$richcompare)return b.tp$richcompare(a,Sk.misceval.swappedOp_[c]);else{if(c==="Eq")if(a&&a.__eq__)return Sk.misceval.call(a.__eq__,undefined,a,b);else if(b&&b.__ne__)return Sk.misceval.call(b.__ne__,undefined,b,a);else if(c==="NotEq")if(a&&a.__ne__)return Sk.misceval.call(a.__ne__,undefined,a,b);else if(b&&
b.__eq__)return Sk.misceval.call(b.__eq__,undefined,b,a);else if(c==="Gt")if(a&&a.__gt__)return Sk.misceval.call(a.__gt__,undefined,a,b);else if(b&&b.__lt__)return Sk.misceval.call(b.__lt__,undefined,b,a);else if(c==="Lt")if(a&&a.__lt__)return Sk.misceval.call(a.__lt__,undefined,a,b);else if(b&&b.__gt__)return Sk.misceval.call(b.__gt__,undefined,b,a);else if(c==="GtE")if(a&&a.__ge__)return Sk.misceval.call(a.__ge__,undefined,a,b);else if(b&&b.__le__)return Sk.misceval.call(b.__le__,undefined,b,a);
else if(c==="LtE")if(a&&a.__le__)return Sk.misceval.call(a.__le__,undefined,a,b);else if(b&&b.__ge__)return Sk.misceval.call(b.__ge__,undefined,b,a);if(a&&a.__cmp__){var d=Sk.misceval.call(a.__cmp__,undefined,a,b);if(c==="Eq")return d===0;else if(c==="NotEq")return d!==0;else if(c==="Lt")return d<0;else if(c==="Gt")return d>0;else if(c==="LtE")return d<=0;else if(c==="GtE")return d>=0}else if(b&&b.__cmp__){d=Sk.misceval.call(b.__cmp__,undefined,b,a);if(c==="Eq")return d===0;else if(c==="NotEq")return d!==
0;else if(c==="Lt")return d>0;else if(c==="Gt")return d<0;else if(c==="LtE")return d>=0;else if(c==="GtE")return d<=0}}}if(c==="Eq")return a===b;if(c==="NotEq")return a!==b;throw new Sk.builtin.ValueError("don't know how to compare '"+a.tp$name+"' and '"+b.tp$name+"'");};goog.exportSymbol("Sk.misceval.richCompareBool",Sk.misceval.richCompareBool);
Sk.misceval.objectRepr=function(a){goog.asserts.assert(a!==undefined,"trying to repr undefined");return a===null?new Sk.builtin.str("None"):a===true?new Sk.builtin.str("True"):a===false?new Sk.builtin.str("False"):typeof a==="number"?new Sk.builtin.str(""+a):a.$r?a.$r():new Sk.builtin.str("<"+a.tp$name+" object>")};goog.exportSymbol("Sk.misceval.objectRepr",Sk.misceval.objectRepr);
Sk.misceval.isTrue=function(a){if(a===true)return true;if(a===false)return false;if(a===null)return false;if(typeof a==="number")return a!==0;if(a.mp$length)return a.mp$length()!==0;if(a.sq$length)return a.sq$length()!==0;return true};goog.exportSymbol("Sk.misceval.isTrue",Sk.misceval.isTrue);Sk.misceval.softspace_=false;
Sk.misceval.print_=function(a){if(Sk.misceval.softspace_){a!=="\n"&&Sk.output(" ");Sk.misceval.softspace_=false}a=new Sk.builtin.str(a);Sk.output(a.v);if(a.v.length===0||!(a.v[a.v.length-1]==="\n"||a.v[a.v.length-1]==="\t"||a.v[a.v.length-1]==="\r")||a.v[a.v.length-1]===" ")Sk.misceval.softspace_=true};goog.exportSymbol("Sk.misceval.print_",Sk.misceval.print_);
Sk.misceval.loadname=function(a,b){var c=b[a];if(c!==undefined)return c;c=Sk.builtins[a];if(c!==undefined)return c;throw new Sk.builtin.NameError("name '"+a+"' is not defined");};goog.exportSymbol("Sk.misceval.loadname",Sk.misceval.loadname);Sk.misceval.call=function(a,b,c){c=Array.prototype.slice.call(arguments,2);return Sk.misceval.apply(a,b,c)};goog.exportSymbol("Sk.misceval.call",Sk.misceval.call);
Sk.misceval.apply=function(a,b,c){if(typeof a==="function"){goog.asserts.assert(b===undefined);return a.apply(null,c)}else{var d=a.tp$call;if(d!==undefined)return d.call(a,c,b);d=a.__call__;if(d!==undefined){c.unshift(a);return Sk.misceval.apply(d,b,c)}throw new TypeError("'"+a.tp$name+"' object is not callable");}};goog.exportSymbol("Sk.misceval.apply",Sk.misceval.apply);
Sk.misceval.buildClass=function(a,b,c,d){var e=Sk.builtin.type,f={};b(a,f);f.__module__=a.__name__;return Sk.misceval.call(e,undefined,c,d,f)};goog.exportSymbol("Sk.misceval.buildClass",Sk.misceval.buildClass);Sk.abstr={};Sk.abstr.binop_type_error=function(a,b,c){throw new TypeError("unsupported operand type(s) for "+c+": '"+a.tp$name+"' and '"+b.tp$name+"'");};Sk.abstr.boNameToSlotFunc_=function(a,b){switch(b){case "Add":return a.nb$add;case "Sub":return a.nb$subtract;case "Mult":return a.nb$multiply;case "Mod":return a.nb$remainder;case "Pow":return a.nb$power}};Sk.abstr.iboNameToSlotFunc_=function(a,b){switch(b){case "Add":return a.nb$inplace_add}};
Sk.abstr.binary_op_=function(a,b,c){var d;d=Sk.abstr.boNameToSlotFunc_(a,c);if(d!==undefined){d=d.call(a,b);if(d!==undefined)return d}d=Sk.abstr.boNameToSlotFunc_(b,c);if(d!==undefined){d=d.call(b,a);if(d!==undefined)return d}if(c==="Add"&&a.sq$concat)return a.sq$concat(b);else if(c==="Mult"&&a.sq$repeat)return Sk.abstr.sequenceRepeat(a.sq$repeat,a,b);else if(c==="Mult"&&b.sq$repeat)return Sk.abstr.sequenceRepeat(b.sq$repeat,b,a);Sk.abstr.binop_type_error(a,b,c)};
Sk.abstr.binary_iop_=function(a,b,c){var d;d=Sk.abstr.iboNameToSlotFunc_(a,c);if(d!==undefined){d=d.call(a,b);if(d!==undefined)return d}d=Sk.abstr.iboNameToSlotFunc_(b,c);if(d!==undefined){d=d.call(b,a);if(d!==undefined)return d}if(c==="Add")if(a.sq$inplace_concat)return a.sq$inplace_concat(b);else{if(a.sq$concat)return a.sq$concat(b)}else if(c==="Mult")if(a.sq$inplace_repeat)return Sk.abstr.sequenceRepeat(a.sq$inplace_repeat,a,b);else if(a.sq$repeat)return Sk.abstr.sequenceRepeat(a.sq$repeat,a,b);
else if(b.sq$repeat)return Sk.abstr.sequenceRepeat(b.sq$repeat,b,a);Sk.abstr.binop_type_error(a,b,c)};
Sk.abstr.numOpAndPromote=function(a,b,c){if(typeof a==="number"&&typeof b==="number"){c=c(a,b);return c>Sk.builtin.lng.threshold$||c<-Sk.builtin.lng.threshold$?[Sk.builtin.lng.fromInt$(a),Sk.builtin.lng.fromInt$(b)]:c}else if(a.constructor===Sk.builtin.lng&&typeof b==="number")return[a,Sk.builtin.lng.fromInt$(b)];else if(b.constructor===Sk.builtin.lng&&typeof a==="number")return[Sk.builtin.lng.fromInt$(a),b]};
Sk.abstr.boNumPromote_={Add:function(a,b){return a+b},Sub:function(a,b){return a-b},Mult:function(a,b){return a*b},Mod:function(a,b){return a%b},Div:function(a,b){if(b===0)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");else return a/b},FloorDiv:function(a,b){return Math.floor(a/b)},Pow:Math.pow,BitAnd:function(a,b){return a&b},BitOr:function(a,b){return a|b},BitXor:function(a,b){return a^b},LShift:function(a,b){return a<<b},RShift:function(a,b){return a>>b}};
Sk.abstr.numberBinOp=function(a,b,c){var d=Sk.abstr.boNumPromote_[c];if(d!==undefined){d=Sk.abstr.numOpAndPromote(a,b,d);if(typeof d==="number")return d;else if(d!==undefined){a=d[0];b=d[1]}}return Sk.abstr.binary_op_(a,b,c)};goog.exportSymbol("Sk.abstr.numberBinOp",Sk.abstr.numberBinOp);
Sk.abstr.numberInplaceBinOp=function(a,b,c){var d=Sk.abstr.boNumPromote_[c];if(d!==undefined){d=Sk.abstr.numOpAndPromote(a,b,d);if(typeof d==="number")return d;else if(d!==undefined){a=d[0];b=d[1]}}return Sk.abstr.binary_iop_(a,b,c)};goog.exportSymbol("Sk.abstr.numberInplaceBinOp",Sk.abstr.numberInplaceBinOp);
Sk.abstr.numberUnaryOp=function(a,b){if(b==="Not")return Sk.misceval.isTrue(a)?false:true;else if(typeof a==="number"||typeof a==="boolean"){if(b==="USub")return-a;if(b==="UAdd")return a;if(b==="Invert")return~a}else{if(b==="USub"&&a.nb$negative)return a.nb$negative();if(b==="UAdd"&&a.nb$positive)return a.nb$positive()}throw new TypeError("unsupported operand type for "+b+" '"+a.tp$name+"'");};goog.exportSymbol("Sk.abstr.numberUnaryOp",Sk.abstr.numberUnaryOp);
Sk.abstr.fixSeqIndex_=function(a,b){if(b<0&&a.sq$length)b+=a.sq$length();return b};Sk.abstr.sequenceContains=function(a,b){if(a.sq$contains)return a.sq$contains(b);if(!a.tp$iter)throw new TypeError("argument of type '"+a.tp$name+"' is not iterable");for(var c=a.tp$iter(),d=c.tp$iternext();d!==undefined;d=c.tp$iternext())if(Sk.misceval.richCompareBool(d,b,"Eq"))return true;return false};Sk.abstr.sequenceGetItem=function(){goog.asserts.fail()};Sk.abstr.sequenceSetItem=function(){goog.asserts.fail()};
Sk.abstr.sequenceDelItem=function(a,b){if(a.sq$ass_item){b=Sk.abstr.fixSeqIndex_(a,b);return a.sq$ass_item(b,null)}throw new TypeError("'"+a.tp$name+"' object does not support item deletion");};Sk.abstr.sequenceRepeat=function(a,b,c){if(Sk.misceval.asIndex(c)===undefined)throw new TypeError("can't multiply sequence by non-int of type '"+c.tp$name+"'");return a.call(b,c)};
Sk.abstr.sequenceGetSlice=function(a,b,c){if(a.sq$slice){b=Sk.abstr.fixSeqIndex_(a,b);c=Sk.abstr.fixSeqIndex_(a,c);return a.sq$slice(b,c)}else if(a.mp$subscript)return a.mp$subscript(new Sk.builtin.slice(b,c));throw new TypeError("'"+a.tp$name+"' object is unsliceable");};Sk.abstr.sequenceDelSlice=function(a,b,c){if(a.sq$ass_slice){b=Sk.abstr.fixSeqIndex_(a,b);c=Sk.abstr.fixSeqIndex_(a,c);return a.sq$ass_slice(b,c,null)}throw new TypeError("'"+a.tp$name+"' doesn't support slice deletion");};
Sk.abstr.sequenceSetSlice=function(a,b,c,d){if(a.sq$ass_slice){b=Sk.abstr.fixSeqIndex_(a,b);c=Sk.abstr.fixSeqIndex_(a,c);a.sq$ass_slice(b,c,d)}else if(a.mp$ass_subscript)a.mp$ass_subscript(new Sk.builtin.slice(b,c),d);else throw new TypeError("'"+a.tp$name+"' object doesn't support slice assignment");};
Sk.abstr.objectDelItem=function(a,b){if(a.mp$ass_subscript)return a.mp$ass_subscript(b,null);if(a.sq$ass_item){var c=Sk.misceval.asIndex(b);if(c===undefined)throw new TypeError("sequence index must be integer, not '"+b.tp$name+"'");return Sk.abstr.sequenceDelItem(a,c)}throw new TypeError("'"+a.tp$name+"' object does not support item deletion");};goog.exportSymbol("Sk.abstr.objectDelItem",Sk.abstr.objectDelItem);
Sk.abstr.objectGetItem=function(a,b){if(a.mp$subscript)return a.mp$subscript(b);else if(Sk.misceval.isIndex(b)&&a.sq$item)return Sk.abstr.sequenceGetItem(a,Sk.misceval.asIndex(b));throw new TypeError("'"+a.tp$name+"' does not support indexing");};goog.exportSymbol("Sk.abstr.objectGetItem",Sk.abstr.objectGetItem);
Sk.abstr.objectSetItem=function(a,b,c){if(a.mp$ass_subscript)return a.mp$ass_subscript(b,c);else if(Sk.misceval.isIndex(b)&&a.sq$ass_item)return Sk.abstr.sequenceSetItem(a,Sk.misceval.asIndex(b),c);throw new TypeError("'"+a.tp$name+"' does not support item assignment");};goog.exportSymbol("Sk.abstr.objectSetItem",Sk.abstr.objectSetItem);Sk.abstr.gattr=function(a,b){var c=a.tp$getattr(b);if(c===undefined)throw new Sk.builtin.AttributeError("'"+a.tp$name+"' object has no attribute '"+b+"'");return c};
goog.exportSymbol("Sk.abstr.gattr",Sk.abstr.gattr);Sk.abstr.sattr=function(a,b,c){a.tp$setattr(b,c)};goog.exportSymbol("Sk.abstr.sattr",Sk.abstr.sattr);Sk.abstr.iter=function(a){return a.tp$iter()};goog.exportSymbol("Sk.abstr.iter",Sk.abstr.iter);Sk.abstr.iternext=function(a){return a.tp$iternext()};goog.exportSymbol("Sk.abstr.iternext",Sk.abstr.iternext);Sk.builtin.list=function(a){if(a instanceof Sk.builtin.list)return a;if(!(this instanceof Sk.builtin.list))return new Sk.builtin.list(a);if(Object.prototype.toString.apply(a)==="[object Array]")this.v=a;else if(a.tp$iter){this.v=[];a=a.tp$iter();for(var b=a.tp$iternext();b!==undefined;b=a.tp$iternext())this.v.push(b)}else throw new Sk.builtin.ValueError("expecting Array or iterable");this.v=this.v;return this};Sk.builtin.list.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("list",Sk.builtin.list);
Sk.builtin.list.prototype.list_iter_=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){if(!(a.$index>=a.$obj.v.length))return a.$obj.v[a.$index++]}};return a};Sk.builtin.list.prototype.list_concat_=function(a){for(var b=this.v.slice(),c=0;c<a.v.length;++c)b.push(a.v[c]);return new Sk.builtin.list(b)};
Sk.builtin.list.prototype.list_ass_item_=function(a,b){if(a<0||a>=this.v.length)throw new Sk.builtin.IndexError("list assignment index out of range");if(b===null)return Sk.builtin.list.prototype.list_ass_slice_.call(this,a,a+1,b);this.v[a]=b};Sk.builtin.list.prototype.list_ass_slice_=function(a,b,c){c=c===null?[]:c.v.slice(0);c.unshift(b-a);c.unshift(a);this.v.splice.apply(this.v,c)};Sk.builtin.list.prototype.tp$name="list";
Sk.builtin.list.prototype.$r=function(){for(var a=[],b=this.tp$iter(),c=b.tp$iternext();c!==undefined;c=b.tp$iternext())a.push(Sk.misceval.objectRepr(c).v);return new Sk.builtin.str("["+a.join(", ")+"]")};Sk.builtin.list.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.list.prototype.tp$hash=Sk.builtin.object.prototype.HashNotImplemented;
Sk.builtin.list.prototype.tp$richcompare=function(a,b){if(this===a)return b==="Eq";var c=this.v;a=a.v;var d=c.length,e=a.length,f;for(f=0;f<d&&f<e;++f)if(!Sk.misceval.richCompareBool(c[f],a[f],"Eq"))break;if(f>=d||f>=e)switch(b){case "Lt":return d<e;case "LtE":return d<=e;case "Eq":return d===e;case "NotEq":return d!==e;case "Gt":return d>e;case "GtE":return d>=e;default:goog.asserts.fail()}if(b==="Eq")return false;if(b==="NotEq")return true;return Sk.misceval.richCompareBool(c[f],a[f],b)};
Sk.builtin.list.prototype.tp$iter=Sk.builtin.list.prototype.list_iter_;Sk.builtin.list.prototype.sq$length=function(){return this.v.length};Sk.builtin.list.prototype.sq$concat=Sk.builtin.list.prototype.list_concat_;Sk.builtin.list.prototype.sq$repeat=function(a){for(var b=[],c=0;c<a;++c)for(var d=0;d<this.v.length;++d)b.push(this.v[d]);return new Sk.builtin.list(b)};Sk.builtin.list.prototype.sq$ass_item=Sk.builtin.list.prototype.list_ass_item_;Sk.builtin.list.prototype.sq$ass_slice=Sk.builtin.list.prototype.list_ass_slice_;
Sk.builtin.list.prototype.list_subscript_=function(a){if(typeof a==="number"){if(a<0)a=this.v.length+a;if(a<0||a>=this.v.length)throw new Sk.builtin.IndexError("list index out of range");return this.v[a]}else if(a instanceof Sk.builtin.slice){var b=[];a.sssiter$(this,function(c,d){b.push(d.v[c])});return new Sk.builtin.list(b)}else throw new TypeError("list indices must be integers, not "+typeof a);};
Sk.builtin.list.prototype.list_ass_item_=function(a,b){if(a<0||a>=this.v.length)throw new Sk.builtin.IndexError("list index out of range");if(b===null)this.list_ass_slice_(a,a+1,b);else this.v[a]=b};
Sk.builtin.list.prototype.list_ass_subscript_=function(a,b){if(Sk.misceval.isIndex(a)){var c=Sk.misceval.asIndex(a);if(c<0)c=this.v.length+c;this.list_ass_item_(c,b)}else if(a instanceof Sk.builtin.slice)if(a.step===1)this.list_ass_slice_(a.start,a.stop,b);else if(b===null){var d=this,e=0,f=a.step>0?1:0;a.sssiter$(this,function(i){d.v.splice(i-e,1);e+=f})}else{var g=[];a.sssiter$(this,function(i){g.push(i)});var h=0;if(g.length!==b.v.length)throw new Sk.builtin.ValueError("attempt to assign sequence of size "+
b.v.length+" to extended slice of size "+g.length);for(c=0;c<g.length;++c){this.v.splice(g[c],1,b.v[h]);h+=1}}else throw new TypeError("list indices must be integers, not "+typeof a);};Sk.builtin.list.prototype.mp$subscript=Sk.builtin.list.prototype.list_subscript_;Sk.builtin.list.prototype.mp$ass_subscript=Sk.builtin.list.prototype.list_ass_subscript_;Sk.builtin.list.prototype.__getitem__=new Sk.builtin.func(function(a,b){return Sk.builtin.list.prototype.list_subscript_.call(a,b)});
Sk.builtin.list.prototype.append=new Sk.builtin.func(function(a,b){a.v.push(b);return null});Sk.builtin.list.prototype.insert=new Sk.builtin.func(function(a,b,c){if(b<0)b=0;else if(b>a.v.length)b=a.v.length-1;a.v.splice(b,0,c)});Sk.builtin.list.prototype.extend=new Sk.builtin.func(function(a,b){for(var c=b.tp$iter(),d=c.tp$iternext();d!==undefined;d=c.tp$iternext())a.v.push(d);return null});
Sk.builtin.list.prototype.pop=new Sk.builtin.func(function(a,b){if(b===undefined)b=a.v.length-1;var c=a.v[b];a.v.splice(b,1);return c});Sk.builtin.list.prototype.index=new Sk.builtin.func(function(a,b){for(var c=a.v.length,d=a.v,e=0;e<c;++e)if(Sk.misceval.richCompareBool(d[e],b,"Eq"))return e;throw new Sk.builtin.ValueError("list.index(x): x not in list");});Sk.builtin.list.prototype.sort=new Sk.builtin.func(function(a){a.v.sort();return null});var interned={};
Sk.builtin.str=function(a){if(a===undefined)throw"error: trying to str() undefined (should be at least null)";if(a instanceof Sk.builtin.str&&a!==Sk.builtin.str.prototype.ob$type)return a;if(!(this instanceof Sk.builtin.str))return new Sk.builtin.str(a);if(a===true)a="True";else if(a===false)a="False";else if(a===null)a="None";else if(typeof a==="number"){a=a.toString();if(a==="Infinity")a="inf";else if(a==="-Infinity")a="-inf"}else if(typeof a==="string")a=a;else if(a.tp$str!==undefined){a=a.tp$str();
if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.ValueError("__str__ didn't return a str");return a}else return Sk.misceval.objectRepr(a);if(interned.hasOwnProperty(a))return interned[a];this.__class__=this.nativeclass$=Sk.builtin.str;this.v=this.v=a;interned[a]=this;return this};goog.exportSymbol("Sk.builtin.str",Sk.builtin.str);Sk.builtin.str.$emptystr=new Sk.builtin.str("");
Sk.builtin.str.prototype.mp$subscript=function(a){if(typeof a==="number"&&Math.floor(a)===a){if(a<0)a=this.v.length+a;if(a<0||a>=this.v.length)throw new Sk.builtin.IndexError("string index out of range");return new Sk.builtin.str(this.v.charAt(a))}else if(a instanceof Sk.builtin.slice){var b="";a.sssiter$(this,function(c,d){if(c>=0&&c<d.v.length)b+=d.v.charAt(c)});return new Sk.builtin.str(b)}else throw new TypeError("string indices must be numbers, not "+typeof a);};
Sk.builtin.str.prototype.sq$length=function(){return this.v.length};Sk.builtin.str.prototype.sq$concat=function(a){return new Sk.builtin.str(this.v+a.v)};Sk.builtin.str.prototype.sq$repeat=function(a){for(var b="",c=0;c<a;++c)b+=this.v;return new Sk.builtin.str(b)};Sk.builtin.str.prototype.sq$item=function(){goog.asserts.fail()};Sk.builtin.str.prototype.sq$slice=function(a,b){return new Sk.builtin.str(this.v.substr(a,b-a))};Sk.builtin.str.prototype.tp$name="str";
Sk.builtin.str.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.str.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){if(!(a.$index>=a.$obj.v.length))return new Sk.builtin.str(a.$obj.v.substr(a.$index++,1))}};return a};
Sk.builtin.str.prototype.$r=function(){var a="'";if(this.v.indexOf("'")!==-1&&this.v.indexOf('"')===-1)a='"';for(var b=this.v.length,c=a,d=0;d<b;++d){var e=this.v.charAt(d);if(e===a||e==="\\")c+="\\"+e;else if(e==="\t")c+="\\t";else if(e==="\n")c+="\\n";else if(e==="\r")c+="\\r";else if(e<" "||e>=127){e=e.charCodeAt(0).toString(16);if(e.length<2)e="0"+e;c+="\\x"+e}else c+=e}c+=a;return new Sk.builtin.str(c)};Sk.builtin.str.alphanum_={};
(function(){var a;for(a="a";a<="z";++a)Sk.builtin.str.alphanum_[a]=1;for(a="A";a<="Z";++a)Sk.builtin.str.alphanum_[a]=1;for(a="0";a<="9";++a)Sk.builtin.str.alphanum_[a]=1})();Sk.builtin.str.re_escape_=function(a){for(var b=[],c=0;c<a.length;++c){var d=a.charAt(c);if(Sk.builtin.str.alphanum_[d])b.push(d);else d==="\\000"?b.push("\\000"):b.push("\\"+d)}return b.join("")};Sk.builtin.str.prototype.lower=new Sk.builtin.func(function(a){return new Sk.builtin.str(a.v.toLowerCase())});
Sk.builtin.str.prototype.upper=new Sk.builtin.func(function(a){return new Sk.builtin.str(a.v.toUpperCase())});Sk.builtin.str.prototype.join=new Sk.builtin.func(function(a,b){for(var c=[],d=b.tp$iter(),e=d.tp$iternext();e!==undefined;e=d.tp$iternext()){if(e.constructor!==Sk.builtin.str)throw"TypeError: sequence item "+c.length+": expected string, "+typeof e+" found";c.push(e.v)}return new Sk.builtin.str(c.join(a.v))});
Sk.builtin.str.prototype.split=new Sk.builtin.func(function(a,b,c){a=a.v.split((new Sk.builtin.str(b)).v,c);b=[];for(c=0;c<a.length;++c)b.push(new Sk.builtin.str(a[c]));return new Sk.builtin.list(b)});Sk.builtin.str.prototype.strip=new Sk.builtin.func(function(a,b){goog.asserts.assert(!b,"todo;");return new Sk.builtin.str(a.v.replace(/^\s+|\s+$/g,""))});Sk.builtin.str.prototype.lstrip=new Sk.builtin.func(function(a,b){goog.asserts.assert(!b,"todo;");return new Sk.builtin.str(a.v.replace(/^\s+/g,""))});
Sk.builtin.str.prototype.rstrip=new Sk.builtin.func(function(a,b){goog.asserts.assert(!b,"todo;");return new Sk.builtin.str(a.v.replace(/\s+$/g,""))});Sk.builtin.str.prototype.partition=new Sk.builtin.func(function(a,b){var c=new Sk.builtin.str(b),d=a.v.indexOf(c.v);if(d<0)return new Sk.builtin.tuple([a,Sk.builtin.str.$emptystr,Sk.builtin.str.$emptystr]);return new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0,d)),c,new Sk.builtin.str(a.v.substring(d+c.v.length))])});
Sk.builtin.str.prototype.rpartition=new Sk.builtin.func(function(a,b){var c=new Sk.builtin.str(b),d=a.v.lastIndexOf(c.v);if(d<0)return new Sk.builtin.tuple([Sk.builtin.str.$emptystr,Sk.builtin.str.$emptystr,a]);return new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0,d)),c,new Sk.builtin.str(a.v.substring(d+c.v.length))])});
Sk.builtin.str.prototype.replace=new Sk.builtin.func(function(a,b,c,d){if(b.constructor!==Sk.builtin.str||c.constructor!==Sk.builtin.str)throw new Sk.builtin.TypeError("expecting a string");goog.asserts.assert(d===undefined,"todo; replace() with could not implemented");b=RegExp(Sk.builtin.str.re_escape_(b.v),"g");return new Sk.builtin.str(a.v.replace(b,c.v))});Sk.builtin.str.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("str",Sk.builtin.str);
Sk.builtin.str.prototype.nb$remainder=function(a){if(a.constructor!==Sk.builtin.tuple&&(a.mp$subscript===undefined||a.constructor===Sk.builtin.str))a=new Sk.builtin.tuple([a]);var b=0,c=this.v.replace(/%(\([a-zA-Z0-9]+\))?([#0 +\-]+)?(\*|[0-9]+)?(\.(\*|[0-9]+))?[hlL]?([diouxXeEfFgGcrs%])/g,function(d,e,f,g,h,i,j){var k;if(e===undefined||e==="")k=b++;var l=false,n=false,p=false,r=false,q=false;if(f){if(f.indexOf("-")!==-1)n=true;else if(f.indexOf("0")!==-1)l=true;if(f.indexOf("+")!==-1)r=true;else if(f.indexOf(" ")!==
-1)p=true;q=f.indexOf("#")!==-1}if(h)h=parseInt(h.substr(1),10);f=function(m,s){var o,t,u=false;if(typeof m==="number"){if(m<0){m=-m;u=true}t=m.toString(s)}else if(m instanceof Sk.builtin.lng){t=m.str$(s,false);u=m.size$<0}goog.asserts.assert(t!==undefined,"unhandled number format");var v=false;if(h)for(o=t.length;o<h;++o){t="0"+t;v=true}o="";if(u)o="-";else if(r)o="+"+o;else if(p)o=" "+o;if(q)if(s===16)o+="0x";else if(s===8&&!v&&t!=="0")o+="0";return[o,t]};d=function(m){var s=m[0];m=m[1];var o;if(g){g=
parseInt(g,10);o=m.length+s.length;if(l)for(o=o;o<g;++o)m="0"+m;else if(n)for(o=o;o<g;++o)m+=" ";else for(o=o;o<g;++o)s=" "+s}return s+m};if(a.constructor===Sk.builtin.tuple)e=a.v[k];else if(a.mp$subscript!==undefined){e=e.substring(1,e.length-1);e=a.mp$subscript(new Sk.builtin.str(e))}else throw new Sk.builtin.AttributeError(a.tp$name+" instance has no attribute 'mp$subscript'");switch(j){case "d":case "i":return d(f(e,10));case "o":return d(f(e,8));case "x":return d(f(e,16));case "X":return d(f(e,
16)).toUpperCase();case "e":case "E":case "f":case "F":case "g":case "G":k=["toExponential","toFixed","toPrecision"]["efg".indexOf(j.toLowerCase())];e=e[k](h);if("EFG".indexOf(j)!==-1)e=e.toUpperCase();return d(["",e]);case "c":if(typeof e==="number")return String.fromCharCode(e);else if(e instanceof Sk.builtin.lng)return String.fromCharCode(e.digit$[0]&255);else if(e.constructor===Sk.builtin.str)return e.v.substr(0,1);else throw new TypeError("an integer is required");case "r":j=Sk.builtin.repr(e);
if(h)return j.v.substr(0,h);return j.v;case "s":j=new Sk.builtin.str(e);if(h)return j.v.substr(0,h);return j.v;case "%":return"%"}});return new Sk.builtin.str(c)};Sk.builtin.tuple=function(a){if(!(a instanceof Sk.builtin.tuple)){if(!(this instanceof Sk.builtin.tuple))return new Sk.builtin.tuple(a);this.v=Object.prototype.toString.apply(a)==="[object Array]"?a:a.v;this.__class__=this.nativeclass$=Sk.builtin.tuple;return this}};
Sk.builtin.tuple.prototype.$r=function(){if(this.v.length===0)return new Sk.builtin.str("()");for(var a=[],b=0;b<this.v.length;++b)a[b]=Sk.misceval.objectRepr(this.v[b]).v;a=a.join(", ");if(this.v.length===1)a+=",";return new Sk.builtin.str("("+a+")")};
Sk.builtin.tuple.prototype.mp$subscript=function(a){if(typeof a==="number"){if(a<0)a=this.v.length+a;if(a<0||a>=this.v.length)throw new Sk.builtin.IndexError("tuple index out of range");return this.v[a]}else if(a instanceof Sk.builtin.slice){var b=[];a.sssiter$(this,function(c,d){b.push(d.v[c])});return new Sk.builtin.tuple(b)}else throw new TypeError("tuple indices must be integers, not "+typeof a);};
Sk.builtin.tuple.prototype.tp$hash=function(){for(var a=1000003,b=3430008,c=this.v.length,d=0;d<c;++d){var e=Sk.builtin.hash(this.v[d]);if(e===-1)return-1;b=(b^e)*a;a+=82520+c+c}b+=97531;if(b===-1)b=-2;return b};Sk.builtin.tuple.prototype.sq$repeat=function(a){for(var b=[],c=0;c<a;++c)for(var d=0;d<this.v.length;++d)b.push(this.v[d]);return new Sk.builtin.tuple(b)};Sk.builtin.tuple.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("tuple",Sk.builtin.tuple);
Sk.builtin.tuple.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){if(!(a.$index>=a.$obj.v.length))return a.$obj.v[a.$index++]}};return a};
Sk.builtin.tuple.prototype.tp$richcompare=function(a,b){var c=this.v;a=a.v;var d=c.length,e=a.length,f;for(f=0;f<d&&f<e;++f)if(!Sk.misceval.richCompareBool(c[f],a[f],"Eq"))break;if(f>=d||f>=e)switch(b){case "Lt":return d<e;case "LtE":return d<=e;case "Eq":return d===e;case "NotEq":return d!==e;case "Gt":return d>e;case "GtE":return d>=e;default:goog.asserts.fail()}if(b==="Eq")return false;if(b==="NotEq")return true;return Sk.misceval.richCompareBool(c[f],a[f],b)};
Sk.builtin.tuple.prototype.sq$concat=function(a){return new Sk.builtin.tuple(this.v.concat(a.v))};Sk.builtin.tuple.prototype.sq$length=function(){return this.v.length};Sk.builtin.dict=function(a){if(!(this instanceof Sk.builtin.dict))return new Sk.builtin.dict(a);for(var b=this.size=0;b<a.length;b+=2)this.mp$ass_subscript(a[b],a[b+1]);this.__class__=this.nativeclass$=Sk.builtin.dict;return this};Sk.builtin.dict.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("dict",Sk.builtin.dict);var kf=Sk.builtin.hash;Sk.builtin.dict.prototype.mp$subscript=function(a){a=this[kf(a)];return a===undefined?undefined:a.rhs};
Sk.builtin.dict.prototype.mp$ass_subscript=function(a,b){var c=kf(a);if(b===null){if(this[c]!==undefined){this.size-=1;delete this[c]}}else{this[c]={lhs:a,rhs:b};this.size+=1}};Sk.builtin.dict.prototype.tp$iter=function(){var a=[],b;for(b in this)if(this.hasOwnProperty(b)){var c=this[b];c&&c.lhs!==undefined&&a.push(b)}var d={tp$iter:function(){return d},$obj:this,$index:0,$keys:a,tp$iternext:function(){if(!(d.$index>=d.$keys.length))return d.$obj[d.$keys[d.$index++]].lhs}};return d};
Sk.builtin.dict.prototype.$r=function(){for(var a=[],b=this.tp$iter(),c=b.tp$iternext();c!==undefined;c=b.tp$iternext()){var d=this.mp$subscript(c);if(d===undefined)d=null;a.push(Sk.misceval.objectRepr(c).v+": "+Sk.misceval.objectRepr(d).v)}return new Sk.builtin.str("{"+a.join(", ")+"}")};Sk.builtin.dict.prototype.mp$length=function(){return this.size};Sk.builtin.dict.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;
Sk.builtin.dict.prototype.get=new Sk.builtin.func(function(a,b,c){a=a.mp$subscript(b);if(a!==undefined)return a;return c});Sk.builtin.dict.prototype.items=new Sk.builtin.func(function(a){for(var b=[],c=a.tp$iter(),d=c.tp$iternext();d!==undefined;d=c.tp$iternext()){var e=a.mp$subscript(d);if(e===undefined)e=null;b.push(new Sk.builtin.tuple([d,e]))}return new Sk.builtin.list(b)});
Sk.builtin.dict.prototype.keys=new Sk.builtin.func(function(a){var b=[];a=a.tp$iter();for(var c=a.tp$iternext();c!==undefined;c=a.tp$iternext())b.push(c);return new Sk.builtin.list(b)});Sk.builtin.dict.prototype.values=new Sk.builtin.func(function(a){for(var b=[],c=a.tp$iter(),d=c.tp$iternext();d!==undefined;d=c.tp$iternext()){d=a.mp$subscript(d);if(d===undefined)d=null;b.push(d)}return new Sk.builtin.list(b)});Sk.builtin.lng=function(a,b){if(a)return Sk.builtin.lng.fromInt$(a);if(!(this instanceof Sk.builtin.lng))return new Sk.builtin.lng(a,b);this.digit$=Array(Math.abs(b));this.size$=b;return this};Sk.builtin.lng.tp$index=function(){goog.asserts.fail("todo;")};Sk.builtin.lng.prototype.tp$name="long";Sk.builtin.lng.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("long",Sk.builtin.lng);Sk.builtin.lng.SHIFT$=15;Sk.builtin.lng.BASE$=1<<Sk.builtin.lng.SHIFT$;Sk.builtin.lng.MASK$=Sk.builtin.lng.BASE$-1;
Sk.builtin.lng.threshold$=Math.pow(2,30);Sk.builtin.lng.fromInt$=function(a){var b=false;if(a<0){a=-a;b=true}for(var c=a,d=0;c;){d+=1;c>>=Sk.builtin.lng.SHIFT$}d=new Sk.builtin.lng(undefined,d);if(b)d.size$=-d.size$;c=a;for(a=0;c;){d.digit$[a]=c&Sk.builtin.lng.MASK$;c>>=Sk.builtin.lng.SHIFT$;a+=1}return d};
Sk.builtin.lng.mulInt$=function(a,b){var c=Math.abs(a.size$),d=new Sk.builtin.lng(undefined,c+1),e=0,f;for(f=0;f<c;++f){e+=a.digit$[f]*b;d.digit$[f]=e&Sk.builtin.lng.MASK$;e>>=Sk.builtin.lng.SHIFT$}d.digit$[f]=e;return Sk.builtin.lng.normalize$(d)};
Sk.longFromStr=function(a){goog.asserts.assert(a.charAt(a.length-1)!=="L"&&a.charAt(a.length-1)!=="l","L suffix should be removed before here");var b=false;if(a.substr(0,1)==="-"){a=a.substr(1);b=true}var c=10;if(a.substr(0,2)==="0x"||a.substr(0,2)==="0X"){a=a.substr(2);c=16}else if(a.substr(0,2)==="0o"){a=a.substr(2);c=8}else if(a.substr(0,1)==="0"){a=a.substr(1);c=8}else if(a.substr(0,2)==="0b"){a=a.substr(2);c=2}for(var d=Sk.builtin.lng.fromInt$(0),e=Sk.builtin.lng.fromInt$(1),f,g=a.length-1;g>=
0;--g){f=Sk.builtin.lng.mulInt$(e,parseInt(a.substr(g,1),16));d=d.nb$add(f);e=Sk.builtin.lng.mulInt$(e,c)}if(b)d.size$=-d.size$;return d};goog.exportSymbol("Sk.longFromStr",Sk.longFromStr);Sk.builtin.lng.prototype.clone=function(){var a=new Sk.builtin.lng(undefined,this.size$);a.digit$=this.digit$.slice(0);return a};
Sk.builtin.lng.prototype.nb$add=function(a){if(this.size$<0)if(a.size$<0){a=Sk.builtin.lng.add$(this,a);a.size$=-a.size$}else a=Sk.builtin.lng.sub$(a,this);else a=a.size$<0?Sk.builtin.lng.sub$(this,a):Sk.builtin.lng.add$(this,a);return a};Sk.builtin.lng.prototype.nb$inplace_add=Sk.builtin.lng.prototype.nb$add;
Sk.builtin.lng.prototype.nb$subtract=function(a){if(this.size$<0){a=a.size$<0?Sk.builtin.lng.sub$(this,a):Sk.builtin.lng.add$(this,a);a.size$=-a.size$}else a=a.size<0?Sk.builtin.lng.add$(this,a):Sk.builtin.lng.sub$(this,a);return a};Sk.builtin.lng.prototype.nb$multiply=function(a){var b=Sk.builtin.lng.mul$(this,a);if(this.size$*a.size$<0)b.size$=-b.size$;return b};
Sk.builtin.lng.prototype.nb$power=function(a){for(var b=Sk.builtin.lng.fromInt$(1),c=this.clone();a.size$>0;){if(a.digit$[0]%2!==0){b=Sk.builtin.lng.mul$(b,c);a.digit$[0]&=-2}c=Sk.builtin.lng.mul$(c,c);a.divremInt$(2)}if(this.size$<0)b.size$=-b.size$;return b};Sk.builtin.lng.prototype.nb$negative=function(){var a=this.clone();a.size$=-a.size$;return a};Sk.builtin.lng.prototype.nb$positive=function(){return this};
Sk.builtin.lng.prototype.divrem$=function(a){var b=Math.abs(this.size$),c=Math.abs(a.size$);if(a.size$===0)throw new Sk.builtin.ZeroDivisionError("long division or modulo by zero");if(b<c||this.digit$[b-1]<a.digit$[c-1])return[0,this];if(c===1){b=this.clone();var d=b.divremInt$(a.digit$[0]);c=new Sk.builtin.lng(undefined,1);c.digit$[0]=d}else{c=Sk.builtin.lng.divremFull$(this,a);b=c[0];c=c[1]}if(this.size$<0!==a.size$<0)b.size$=-b.size$;if(this.size$<0&&c.size$!==0)c.size$=-c.size$;return[b,c]};
Sk.builtin.lng.divremFull$=function(){throw"todo;";};Sk.builtin.lng.normalize$=function(a){for(var b=Math.abs(a.size$),c=b;c>0&&a.digit$[c-1]===0;)--c;if(c!==b)a.size$=a.size$<0?-c:c;return a};
Sk.builtin.lng.add$=function(a,b){var c=Math.abs(a.size$),d=Math.abs(b.size$),e,f,g=0;if(c<d){e=a;a=b;b=e;e=c;c=d;d=e}e=new Sk.builtin.lng(undefined,c+1);for(f=0;f<d;++f){g+=a.digit$[f]+b.digit$[f];e.digit$[f]=g&Sk.builtin.lng.MASK$;g>>=Sk.builtin.lng.SHIFT$}for(;f<c;++f){g+=a.digit$[f];e.digit$[f]=g&Sk.builtin.lng.MASK$;g>>=Sk.builtin.lng.SHIFT$}e.digit$[f]=g;return Sk.builtin.lng.normalize$(e)};
Sk.builtin.lng.sub$=function(a,b){var c=Math.abs(a.size$),d=Math.abs(b.size$),e,f,g=1,h=0;if(c<d){g=-1;e=a;a=b;b=e;e=c;c=d;d=e}else if(c===d){for(f=c;--f>=0&&a.digit$[f]===b.digit$[f];);if(f<0)return new Sk.builtin.lng(undefined,0);if(a.digit$[f]<b.digit$[f]){g=-1;e=a;a=b;b=e}c=d=f+1}e=new Sk.builtin.lng(undefined,c);for(f=0;f<d;++f){h=a.digit$[f]-b.digit$[f]-h;e.digit$[f]=h&Sk.builtin.lng.MASK$;h>>=Sk.builtin.lng.SHIFT$;h&=1}for(;f<c;++f){h=a.digit$[f]-h;e.digit$[f]=h&Sk.builtin.lng.MASK$;h>>=Sk.builtin.lng.SHIFT$;
h&=1}goog.asserts.assert(h===0);if(g<0)e.size$=-e.size$;return Sk.builtin.lng.normalize$(e)};
Sk.builtin.lng.mul$=function(a,b){var c=Math.abs(a.size$),d=Math.abs(b.size$),e=new Sk.builtin.lng(undefined,c+d),f;for(f=0;f<c+d;++f)e.digit$[f]=0;for(f=0;f<c;++f){for(var g=0,h=f,i=a.digit$[f],j=0;j<d;++j){g+=e.digit$[h]+b.digit$[j]*i;e.digit$[h++]=g&Sk.builtin.lng.MASK$;g>>=Sk.builtin.lng.SHIFT$;goog.asserts.assert(g<=Sk.builtin.lng.MASK$)}if(g)e.digit$[h++]+=g&Sk.builtin.lng.MASK$}Sk.builtin.lng.normalize$(e);return e};Sk.builtin.lng.prototype.nb$nonzero=function(){return this.size$!==0};
Sk.builtin.lng.prototype.divremInt$=function(a){for(var b,c=Math.abs(this.size$);--c>=0;){var d;b=(b<<Sk.builtin.lng.SHIFT$)+this.digit$[c];this.digit$[c]=d=Math.floor(b/a);b-=d*a}Sk.builtin.lng.normalize$(this);return b};Sk.builtin.lng.prototype.$r=function(){return new Sk.builtin.str(this.str$(10,true)+"L")};Sk.builtin.lng.prototype.tp$str=function(){return new Sk.builtin.str(this.str$(10,true))};
Sk.builtin.lng.prototype.str$=function(a,b){if(this.size$===0)return"0";if(a===undefined)a=10;if(b===undefined)b=true;for(var c="",d=this.clone();d.nb$nonzero();){var e=d.divremInt$(a);c="0123456789abcdef".substring(e,e+1)+c}return(b&&this.size$<0?"-":"")+c};Sk.builtin.int_=function(a,b){if(a instanceof Sk.builtin.str){if(b===undefined)b=10;return parseInt(a.v,b)}return a|0};Sk.builtin.int_.prototype.tp$name="int";Sk.builtin.int_.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("int",Sk.builtin.int_);Sk.builtin.float_=function(a){if(a instanceof Sk.builtin.str){if(a.v==="inf")return Infinity;if(a.v==="-inf")return-Infinity;return parseFloat(a.v)}return a};Sk.builtin.float_.prototype.tp$name="float";Sk.builtin.float_.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("float",Sk.builtin.float_);Sk.builtin.slice=function(a,b,c){if(!(this instanceof Sk.builtin.slice))return new Sk.builtin.slice(a,b,c);if(b===undefined&&c===undefined){b=a;a=null}a||(a=null);if(b===undefined)b=null;if(c===undefined)c=null;this.start=a;this.stop=b;this.step=c;return this};Sk.builtin.slice.prototype.tp$str=function(){var a=Sk.builtin.repr(this.start).v,b=Sk.builtin.repr(this.stop).v,c=Sk.builtin.repr(this.step).v;return new Sk.builtin.str("slice("+a+", "+b+", "+c+")")};
Sk.builtin.slice.prototype.indices=function(a){var b=this.start,c=this.stop,d=this.step;if(d===null)d=1;if(d>0){if(b===null)b=0;if(c===null)c=a;if(b<0)b=a+b;if(c<0)c=a+c}else{if(b===null)b=a-1;else if(b<0)b=a+b;if(c===null)c=-1;else if(c<0)c=a+c}return[b,c,d]};Sk.builtin.slice.prototype.sssiter$=function(a,b){var c=this.indices(typeof a==="number"?a:a.v.length);if(c[2]>0){var d;for(d=c[0];d<c[1];d+=c[2])if(b(d,a)===false)break}else for(d=c[0];d>c[1];d+=c[2])if(b(d,a)===false)break};Sk.builtin.module=function(){};goog.exportSymbol("Sk.builtin.module",Sk.builtin.module);Sk.builtin.module.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("module",Sk.builtin.module);Sk.builtin.module.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.module.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;Sk.builtin.generator=function(a,b,c,d,e){if(a){this.func_code=a;this.func_globals=b||null;this.gi$running=false;this.gi$resumeat=0;this.gi$locals={};if(c.length>0)for(b=0;b<a.co_varnames.length;++b)this.gi$locals[a.co_varnames[b]]=c[b];if(e!==undefined)for(var f in e)d[f]=e[f];this.func_closure=d;return this}};goog.exportSymbol("Sk.builtin.generator",Sk.builtin.generator);Sk.builtin.generator.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.generator.prototype.tp$iter=function(){return this};
Sk.builtin.generator.prototype.tp$iternext=function(){this.gi$running=true;var a=[this];this.func_closure&&a.push(this.func_closure);a=this.func_code.apply(this.func_globals,a);this.gi$running=false;goog.asserts.assert(a!==undefined);if(a!==null){this.gi$resumeat=a[0];return a=a[1]}};Sk.builtin.generator.prototype.next=new Sk.builtin.func(function(a){return a.tp$iternext()});Sk.builtin.generator.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("generator",Sk.builtin.generator);
Sk.builtin.generator.prototype.$r=function(){return new Sk.builtin.str("<generator object "+this.func_code.co_name.v+">")};Sk.builtin.file=function(a,b){this.mode=b;this.name=a;this.closed=false;this.data$=Sk.read(a.v);this.pos$=0;return this};Sk.builtin.file.prototype.$r=function(){return new Sk.builtin.str("<"+(this.closed?"closed":"open")+"file '"+this.name+"', mode '"+this.mode+"'>")};Sk.builtin.file.close=function(a){a.closed=true};Sk.builtin.file.flush=function(){};Sk.builtin.file.fileno=function(){return 10};Sk.builtin.file.isatty=function(){return false};
Sk.builtin.file.next=function(){throw"todo; file.next";};Sk.builtin.file.read=function(a,b){if(a.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var c=a.data$.length;if(b===undefined)b=c;var d=new Sk.builtin.str(a.data$.substr(a.pos$,b));a.pos$+=b;if(a.pos$>=c)a.pos$=c;return d};Sk.builtin.file.readline=function(){goog.asserts.fail()};Sk.builtin.file.readlines=function(){goog.asserts.fail()};Sk.builtin.file.seek=function(){goog.asserts.fail()};Sk.builtin.file.tell=function(){goog.asserts.fail()};
Sk.builtin.file.truncate=function(){goog.asserts.fail()};Sk.builtin.file.write=function(){goog.asserts.fail()};Sk.builtin.file.writelines=function(){goog.asserts.fail()};Sk.ffi=Sk.ffi||{};Sk.ffi.remapToPy=function(a){if(Object.prototype.toString.call(a)==="[object Array]"){for(var b=[],c=0;c<a.length;++c)b.push(Sk.ffi.remapToPy(a[c]));return new Sk.builtin.list(b)}else if(typeof a==="object"){b=[];for(c in a){b.push(Sk.ffi.remapToPy(c));b.push(Sk.ffi.remapToPy(a[c]))}return new Sk.builtin.dict(b)}else if(typeof a==="string")return new Sk.builtin.str(a);else if(typeof a==="number"||typeof a==="boolean")return a;goog.asserts.fail("unhandled remap type")};
goog.exportSymbol("Sk.ffi.remapToPy",Sk.ffi.remapToPy);Sk.ffi.remapToJs=function(a){if(a instanceof Sk.builtin.dict){for(var b={},c=a.tp$iter(),d=c.tp$iternext();d!==undefined;d=c.tp$iternext()){var e=a.mp$subscript(d);if(e===undefined)e=null;d=Sk.ffi.remapToJs(d);b[d]=Sk.ffi.remapToJs(e)}return b}else if(a instanceof Sk.builtin.list){b=[];for(c=0;c<a.v.length;++c)b.push(Sk.ffi.remapToJs(a.v[c]));return b}else return typeof a==="number"||typeof a==="boolean"?a:a.v};
goog.exportSymbol("Sk.ffi.remapToJs",Sk.ffi.remapToJs);Sk.ffi.callback=function(a){if(a===undefined)return a;return function(){return Sk.misceval.apply(a,undefined,Array.prototype.slice.call(arguments,0))}};goog.exportSymbol("Sk.ffi.callback",Sk.ffi.callback);Sk.ffi.stdwrap=function(a,b){var c=new a;c.v=b;return c};goog.exportSymbol("Sk.ffi.stdwrap",Sk.ffi.stdwrap);
Sk.ffi.basicwrap=function(a){if(typeof a==="number"||typeof a==="boolean")return a;if(typeof a==="string")return new Sk.builtin.str(a);goog.asserts.fail("unexpected type for basicwrap")};goog.exportSymbol("Sk.ffi.basicwrap",Sk.ffi.basicwrap);Sk.ffi.unwrapo=function(a){if(a!==undefined)return a.v};goog.exportSymbol("Sk.ffi.unwrapo",Sk.ffi.unwrapo);Sk.ffi.unwrapn=function(a){if(a===null)return null;return a.v};goog.exportSymbol("Sk.ffi.unwrapn",Sk.ffi.unwrapn);Sk.Tokenizer=function(a,b,c){this.filename=a;this.callback=c;this.parenlev=this.lnum=0;this.continued=false;this.namechars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";this.numchars="0123456789";this.contstr="";this.needcont=false;this.contline=undefined;this.indents=[0];this.endprog=/.*/;this.strstart=[-1,-1];this.interactive=b;this.doneFunc=function(){for(var d=1;d<this.indents.length;++d)if(this.callback(Sk.Tokenizer.Tokens.T_DEDENT,"",[this.lnum,0],[this.lnum,0],""))return"done";if(this.callback(Sk.Tokenizer.Tokens.T_ENDMARKER,
"",[this.lnum,0],[this.lnum,0],""))return"done";return"failed"}};
Sk.Tokenizer.Tokens={T_ENDMARKER:0,T_NAME:1,T_NUMBER:2,T_STRING:3,T_NEWLINE:4,T_INDENT:5,T_DEDENT:6,T_LPAR:7,T_RPAR:8,T_LSQB:9,T_RSQB:10,T_COLON:11,T_COMMA:12,T_SEMI:13,T_PLUS:14,T_MINUS:15,T_STAR:16,T_SLASH:17,T_VBAR:18,T_AMPER:19,T_LESS:20,T_GREATER:21,T_EQUAL:22,T_DOT:23,T_PERCENT:24,T_BACKQUOTE:25,T_LBRACE:26,T_RBRACE:27,T_EQEQUAL:28,T_NOTEQUAL:29,T_LESSEQUAL:30,T_GREATEREQUAL:31,T_TILDE:32,T_CIRCUMFLEX:33,T_LEFTSHIFT:34,T_RIGHTSHIFT:35,T_DOUBLESTAR:36,T_PLUSEQUAL:37,T_MINEQUAL:38,T_STAREQUAL:39,
T_SLASHEQUAL:40,T_PERCENTEQUAL:41,T_AMPEREQUAL:42,T_VBAREQUAL:43,T_CIRCUMFLEXEQUAL:44,T_LEFTSHIFTEQUAL:45,T_RIGHTSHIFTEQUAL:46,T_DOUBLESTAREQUAL:47,T_DOUBLESLASH:48,T_DOUBLESLASHEQUAL:49,T_AT:50,T_OP:51,T_COMMENT:52,T_NL:53,T_RARROW:54,T_ERRORTOKEN:55,T_N_TOKENS:56,T_NT_OFFSET:256};function group(){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function any(){return group.apply(null,arguments)+"*"}function maybe(){return group.apply(null,arguments)+"?"}
var Whitespace="[ \\f\\t]*",Comment_="#[^\\r\\n]*",Ident="[a-zA-Z_]\\w*",Binnumber="0[bB][01]*",Hexnumber="0[xX][\\da-fA-F]*[lL]?",Octnumber="0[oO]?[0-7]*[lL]?",Decnumber="[1-9]\\d*[lL]?",Intnumber=group(Binnumber,Hexnumber,Octnumber,Decnumber),Exponent="[eE][-+]?\\d+",Pointfloat=group("\\d+\\.\\d*","\\.\\d+")+maybe(Exponent),Expfloat="\\d+"+Exponent,Floatnumber=group(Pointfloat,Expfloat),Imagnumber=group("\\d+[jJ]",Floatnumber+"[jJ]"),Number_=group(Imagnumber,Floatnumber,Intnumber),Single="[^'\\\\]*(?:\\\\.[^'\\\\]*)*'",
Double_='[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',Single3="[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''",Double3='[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""',Triple=group("[ubUB]?[rR]?'''",'[ubUB]?[rR]?"""'),String_=group("[uU]?[rR]?'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'",'[uU]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"'),Operator=group("\\*\\*=?",">>=?","<<=?","<>","!=","//=?","->","[+\\-*/%&|^=<>]=?","~"),Bracket="[\\][(){}]",Special=group("\\r?\\n","[:;.,`@]"),Funny=group(Operator,Bracket,Special),ContStr=
group("[uUbB]?[rR]?'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+group("'","\\\\\\r?\\n"),'[uUbB]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+group('"',"\\\\\\r?\\n")),PseudoExtras=group("\\\\\\r?\\n",Comment_,Triple),PseudoToken=group(PseudoExtras,Number_,Funny,ContStr,Ident),pseudoprog=RegExp(PseudoToken),single3prog=RegExp(Single3,"g"),double3prog=RegExp(Double3,"g"),endprogs={"'":RegExp(Single,"g"),'"':RegExp(Double_,"g"),"'''":single3prog,'"""':double3prog,"r'''":single3prog,'r"""':double3prog,"u'''":single3prog,
'u"""':double3prog,"b'''":single3prog,'b"""':double3prog,"ur'''":single3prog,'ur"""':double3prog,"br'''":single3prog,'br"""':double3prog,"R'''":single3prog,'R"""':double3prog,"U'''":single3prog,'U"""':double3prog,"B'''":single3prog,'B"""':double3prog,"uR'''":single3prog,'uR"""':double3prog,"Ur'''":single3prog,'Ur"""':double3prog,"UR'''":single3prog,'UR"""':double3prog,"bR'''":single3prog,'bR"""':double3prog,"Br'''":single3prog,'Br"""':double3prog,"BR'''":single3prog,'BR"""':double3prog,r:null,R:null,
u:null,U:null,b:null,B:null},triple_quoted={"'''":true,'"""':true,"r'''":true,'r"""':true,"R'''":true,'R"""':true,"u'''":true,'u"""':true,"U'''":true,'U"""':true,"b'''":true,'b"""':true,"B'''":true,'B"""':true,"ur'''":true,'ur"""':true,"Ur'''":true,'Ur"""':true,"uR'''":true,'uR"""':true,"UR'''":true,'UR"""':true,"br'''":true,'br"""':true,"Br'''":true,'Br"""':true,"bR'''":true,'bR"""':true,"BR'''":true,'BR"""':true},single_quoted={"'":true,'"':true,"r'":true,'r"':true,"R'":true,'R"':true,"u'":true,
'u"':true,"U'":true,'U"':true,"b'":true,'b"':true,"B'":true,'B"':true,"ur'":true,'ur"':true,"Ur'":true,'Ur"':true,"uR'":true,'uR"':true,"UR'":true,'UR"':true,"br'":true,'br"':true,"Br'":true,'Br"':true,"bR'":true,'bR"':true,"BR'":true,'BR"':true};(function(){for(var a in triple_quoted);for(a in single_quoted);})();var tabsize=8;function contains(a,b){for(var c=a.length;c--;)if(a[c]===b)return true;return false}
function rstrip(a,b){for(var c=a.length;c>0;--c)if(b.indexOf(a.charAt(c-1))===-1)break;return a.substring(0,c)}
Sk.Tokenizer.prototype.generateTokens=function(a){var b,c,d,e,f;a||(a="");this.lnum+=1;c=0;f=a.length;if(this.contstr.length>0){if(!a)throw new Sk.builtin.TokenError("EOF in multi-line string",this.filename,this.strstart[0],this.strstart[1],this.contline);if(b=this.endprog.test(a)){c=e=this.endprog.lastIndex;if(this.callback(Sk.Tokenizer.Tokens.T_STRING,this.contstr+a.substring(0,e),this.strstart,[this.lnum,e],this.contline+a))return"done";this.contstr="";this.needcont=false;this.contline=undefined}else{if(this.needcont&&
a.substring(a.length-2)!=="\\\n"&&a.substring(a.length-3)!=="\\\r\n"){if(this.callback(Sk.Tokenizer.Tokens.T_ERRORTOKEN,this.contstr+a,this.strstart,[this.lnum,a.length],this.contline))return"done";this.contstr="";this.contline=undefined}else{this.contstr+=a;this.contline+=a}return false}}else if(this.parenlev===0&&!this.continued){if(!a)return this.doneFunc();for(d=0;c<f;){if(a.charAt(c)===" ")d+=1;else if(a.charAt(c)==="\t")d=(d/tabsize+1)*tabsize;else if(a.charAt(c)==="\u000c")d=0;else break;c+=
1}if(c===f)return this.doneFunc();if("#\r\n".indexOf(a.charAt(c))!==-1)if(a.charAt(c)==="#"){f=rstrip(a.substring(c),"\r\n");d=c+f.length;if(this.callback(Sk.Tokenizer.Tokens.T_COMMENT,f,[this.lnum,c],[this.lnum,c+f.length],a))return"done";if(this.callback(Sk.Tokenizer.Tokens.T_NL,a.substring(d),[this.lnum,d],[this.lnum,a.length],a))return"done";return false}else{if(this.callback(Sk.Tokenizer.Tokens.T_NL,a.substring(c),[this.lnum,c],[this.lnum,a.length],a))return"done";if(!this.interactive)return false}if(d>
this.indents[this.indents.length-1]){this.indents.push(d);if(this.callback(Sk.Tokenizer.Tokens.T_INDENT,a.substring(0,c),[this.lnum,0],[this.lnum,c],a))return"done"}for(;d<this.indents[this.indents.length-1];){if(!contains(this.indents,d))throw new Sk.builtin.IndentationError("unindent does not match any outer indentation level",this.filename,this.lnum,c,a);this.indents.splice(this.indents.length-1,1);if(this.callback(Sk.Tokenizer.Tokens.T_DEDENT,"",[this.lnum,c],[this.lnum,c],a))return"done"}}else{if(!a)throw new Sk.builtin.TokenError("EOF in multi-line statement",
this.filename,this.lnum,0,a);this.continued=false}for(;c<f;){for(;a.charAt(c)===" "||a.charAt(c)==="\u000c"||a.charAt(c)==="\t";)c+=1;var g=pseudoprog.exec(a.substring(c));if(g){d=c;e=d+g[1].length;g=[this.lnum,d];b=[this.lnum,e];c=e;e=a.substring(d,e);var h=a.charAt(d);if(this.numchars.indexOf(h)!==-1||h==="."&&e!=="."){if(this.callback(Sk.Tokenizer.Tokens.T_NUMBER,e,g,b,a))return"done"}else if(h==="\r"||h==="\n"){d=Sk.Tokenizer.Tokens.T_NEWLINE;if(this.parenlev>0)d=Sk.Tokenizer.Tokens.T_NL;if(this.callback(d,
e,g,b,a))return"done"}else if(h==="#"){if(this.callback(Sk.Tokenizer.Tokens.T_COMMENT,e,g,b,a))return"done"}else if(triple_quoted.hasOwnProperty(e)){this.endprog=endprogs[e];if(b=this.endprog.test(a.substring(c))){c=this.endprog.lastIndex+c;e=a.substring(d,c);if(this.callback(Sk.Tokenizer.Tokens.T_STRING,e,g,[this.lnum,c],a))return"done"}else{this.strstart=[this.lnum,d];this.contstr=a.substring(d);this.contline=a;break}}else if(single_quoted.hasOwnProperty(h)||single_quoted.hasOwnProperty(e.substring(0,
2))||single_quoted.hasOwnProperty(e.substring(0,3)))if(e[e.length-1]==="\n"){this.strstart=[this.lnum,d];this.endprog=endprogs[h]||endprogs[e[1]]||endprogs[e[2]];this.contstr=a.substring(d);this.needcont=true;this.contline=a;break}else{if(this.callback(Sk.Tokenizer.Tokens.T_STRING,e,g,b,a))return"done"}else if(this.namechars.indexOf(h)!==-1){if(this.callback(Sk.Tokenizer.Tokens.T_NAME,e,g,b,a))return"done"}else if(h==="\\"){if(this.callback(Sk.Tokenizer.Tokens.T_NL,e,g,[this.lnum,c],a))return"done";
this.continued=true}else{if("([{".indexOf(h)!==-1)this.parenlev+=1;else if(")]}".indexOf(h)!==-1)this.parenlev-=1;if(this.callback(Sk.Tokenizer.Tokens.T_OP,e,g,b,a))return"done"}}else{if(this.callback(Sk.Tokenizer.Tokens.T_ERRORTOKEN,a.charAt(c),[this.lnum,c],[this.lnum,c+1],a))return"done";c+=1}}return false};
Sk.Tokenizer.tokenNames={0:"T_ENDMARKER",1:"T_NAME",2:"T_NUMBER",3:"T_STRING",4:"T_NEWLINE",5:"T_INDENT",6:"T_DEDENT",7:"T_LPAR",8:"T_RPAR",9:"T_LSQB",10:"T_RSQB",11:"T_COLON",12:"T_COMMA",13:"T_SEMI",14:"T_PLUS",15:"T_MINUS",16:"T_STAR",17:"T_SLASH",18:"T_VBAR",19:"T_AMPER",20:"T_LESS",21:"T_GREATER",22:"T_EQUAL",23:"T_DOT",24:"T_PERCENT",25:"T_BACKQUOTE",26:"T_LBRACE",27:"T_RBRACE",28:"T_EQEQUAL",29:"T_NOTEQUAL",30:"T_LESSEQUAL",31:"T_GREATEREQUAL",32:"T_TILDE",33:"T_CIRCUMFLEX",34:"T_LEFTSHIFT",
35:"T_RIGHTSHIFT",36:"T_DOUBLESTAR",37:"T_PLUSEQUAL",38:"T_MINEQUAL",39:"T_STAREQUAL",40:"T_SLASHEQUAL",41:"T_PERCENTEQUAL",42:"T_AMPEREQUAL",43:"T_VBAREQUAL",44:"T_CIRCUMFLEXEQUAL",45:"T_LEFTSHIFTEQUAL",46:"T_RIGHTSHIFTEQUAL",47:"T_DOUBLESTAREQUAL",48:"T_DOUBLESLASH",49:"T_DOUBLESLASHEQUAL",50:"T_AT",51:"T_OP",52:"T_COMMENT",53:"T_NL",54:"T_RARROW",55:"T_ERRORTOKEN",56:"T_N_TOKENS",256:"T_NT_OFFSET"};goog.exportSymbol("Sk.Tokenizer",Sk.Tokenizer);
goog.exportSymbol("Sk.Tokenizer.prototype.generateTokens",Sk.Tokenizer.prototype.generateTokens);goog.exportSymbol("Sk.Tokenizer.tokenNames",Sk.Tokenizer.tokenNames);Sk.OpMap={"(":Sk.Tokenizer.Tokens.T_LPAR,")":Sk.Tokenizer.Tokens.T_RPAR,"[":Sk.Tokenizer.Tokens.T_LSQB,"]":Sk.Tokenizer.Tokens.T_RSQB,":":Sk.Tokenizer.Tokens.T_COLON,",":Sk.Tokenizer.Tokens.T_COMMA,";":Sk.Tokenizer.Tokens.T_SEMI,"+":Sk.Tokenizer.Tokens.T_PLUS,"-":Sk.Tokenizer.Tokens.T_MINUS,"*":Sk.Tokenizer.Tokens.T_STAR,"/":Sk.Tokenizer.Tokens.T_SLASH,"|":Sk.Tokenizer.Tokens.T_VBAR,"&":Sk.Tokenizer.Tokens.T_AMPER,"<":Sk.Tokenizer.Tokens.T_LESS,">":Sk.Tokenizer.Tokens.T_GREATER,"=":Sk.Tokenizer.Tokens.T_EQUAL,
".":Sk.Tokenizer.Tokens.T_DOT,"%":Sk.Tokenizer.Tokens.T_PERCENT,"`":Sk.Tokenizer.Tokens.T_BACKQUOTE,"{":Sk.Tokenizer.Tokens.T_LBRACE,"}":Sk.Tokenizer.Tokens.T_RBRACE,"@":Sk.Tokenizer.Tokens.T_AT,"==":Sk.Tokenizer.Tokens.T_EQEQUAL,"!=":Sk.Tokenizer.Tokens.T_NOTEQUAL,"<>":Sk.Tokenizer.Tokens.T_NOTEQUAL,"<=":Sk.Tokenizer.Tokens.T_LESSEQUAL,">=":Sk.Tokenizer.Tokens.T_GREATEREQUAL,"~":Sk.Tokenizer.Tokens.T_TILDE,"^":Sk.Tokenizer.Tokens.T_CIRCUMFLEX,"<<":Sk.Tokenizer.Tokens.T_LEFTSHIFT,">>":Sk.Tokenizer.Tokens.T_RIGHTSHIFT,
"**":Sk.Tokenizer.Tokens.T_DOUBLESTAR,"+=":Sk.Tokenizer.Tokens.T_PLUSEQUAL,"-=":Sk.Tokenizer.Tokens.T_MINEQUAL,"*=":Sk.Tokenizer.Tokens.T_STAREQUAL,"/=":Sk.Tokenizer.Tokens.T_SLASHEQUAL,"%=":Sk.Tokenizer.Tokens.T_PERCENTEQUAL,"&=":Sk.Tokenizer.Tokens.T_AMPEREQUAL,"|=":Sk.Tokenizer.Tokens.T_VBAREQUAL,"^=":Sk.Tokenizer.Tokens.T_CIRCUMFLEXEQUAL,"<<=":Sk.Tokenizer.Tokens.T_LEFTSHIFTEQUAL,">>=":Sk.Tokenizer.Tokens.T_RIGHTSHIFTEQUAL,"**=":Sk.Tokenizer.Tokens.T_DOUBLESTAREQUAL,"//":Sk.Tokenizer.Tokens.T_DOUBLESLASH,
"//=":Sk.Tokenizer.Tokens.T_DOUBLESLASHEQUAL,"->":Sk.Tokenizer.Tokens.T_RARROW};
Sk.ParseTables={sym:{and_expr:257,and_test:258,arglist:259,argument:260,arith_expr:261,assert_stmt:262,atom:263,augassign:264,break_stmt:265,classdef:266,comp_op:267,comparison:268,compound_stmt:269,continue_stmt:270,decorated:271,decorator:272,decorators:273,del_stmt:274,dictmaker:275,dotted_as_name:276,dotted_as_names:277,dotted_name:278,encoding_decl:279,eval_input:280,except_clause:281,exec_stmt:282,expr:283,expr_stmt:284,exprlist:285,factor:286,file_input:287,flow_stmt:288,for_stmt:289,fpdef:290,
fplist:291,funcdef:292,gen_for:293,gen_if:294,gen_iter:295,global_stmt:296,if_stmt:297,import_as_name:298,import_as_names:299,import_from:300,import_name:301,import_stmt:302,lambdef:303,list_for:304,list_if:305,list_iter:306,listmaker:307,not_test:308,old_lambdef:309,old_test:310,or_test:311,parameters:312,pass_stmt:313,power:314,print_stmt:315,raise_stmt:316,return_stmt:317,shift_expr:318,simple_stmt:319,single_input:256,sliceop:320,small_stmt:321,stmt:322,subscript:323,subscriptlist:324,suite:325,
term:326,test:327,testlist:328,testlist1:329,testlist_gexp:330,testlist_safe:331,trailer:332,try_stmt:333,varargslist:334,while_stmt:335,with_stmt:336,with_var:337,xor_expr:338,yield_expr:339,yield_stmt:340},number2symbol:{256:"single_input",257:"and_expr",258:"and_test",259:"arglist",260:"argument",261:"arith_expr",262:"assert_stmt",263:"atom",264:"augassign",265:"break_stmt",266:"classdef",267:"comp_op",268:"comparison",269:"compound_stmt",270:"continue_stmt",271:"decorated",272:"decorator",273:"decorators",
274:"del_stmt",275:"dictmaker",276:"dotted_as_name",277:"dotted_as_names",278:"dotted_name",279:"encoding_decl",280:"eval_input",281:"except_clause",282:"exec_stmt",283:"expr",284:"expr_stmt",285:"exprlist",286:"factor",287:"file_input",288:"flow_stmt",289:"for_stmt",290:"fpdef",291:"fplist",292:"funcdef",293:"gen_for",294:"gen_if",295:"gen_iter",296:"global_stmt",297:"if_stmt",298:"import_as_name",299:"import_as_names",300:"import_from",301:"import_name",302:"import_stmt",303:"lambdef",304:"list_for",
305:"list_if",306:"list_iter",307:"listmaker",308:"not_test",309:"old_lambdef",310:"old_test",311:"or_test",312:"parameters",313:"pass_stmt",314:"power",315:"print_stmt",316:"raise_stmt",317:"return_stmt",318:"shift_expr",319:"simple_stmt",320:"sliceop",321:"small_stmt",322:"stmt",323:"subscript",324:"subscriptlist",325:"suite",326:"term",327:"test",328:"testlist",329:"testlist1",330:"testlist_gexp",331:"testlist_safe",332:"trailer",333:"try_stmt",334:"varargslist",335:"while_stmt",336:"with_stmt",
337:"with_var",338:"xor_expr",339:"yield_expr",340:"yield_stmt"},dfas:{256:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1}],257:[[[[37,1]],[[38,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],258:[[[[39,1]],[[40,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],259:[[[[41,1],[42,2],[43,3]],[[44,4]],[[45,5],[0,2]],[[44,
6]],[[45,7],[0,4]],[[41,1],[42,2],[43,3],[0,5]],[[0,6]],[[42,4],[43,3]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1,41:1,43:1}],260:[[[[44,1]],[[46,2],[47,3],[0,1]],[[0,2]],[[44,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],261:[[[[48,1]],[[24,0],[35,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],262:[[[[19,1]],[[44,2]],[[45,3],[0,2]],[[44,4]],[[0,4]]],{19:1}],263:[[[[17,1],[8,2],[9,5],[28,4],[11,3],[13,6],[20,2]],[[17,1],[0,1]],[[0,2]],[[49,7],[50,2]],
[[51,2],[52,8],[53,8]],[[54,9],[55,2]],[[56,10]],[[50,2]],[[51,2]],[[55,2]],[[13,2]]],{8:1,9:1,11:1,13:1,17:1,20:1,28:1}],264:[[[[57,1],[58,1],[59,1],[60,1],[61,1],[62,1],[63,1],[64,1],[65,1],[66,1],[67,1],[68,1]],[[0,1]]],{57:1,58:1,59:1,60:1,61:1,62:1,63:1,64:1,65:1,66:1,67:1,68:1}],265:[[[[31,1]],[[0,1]]],{31:1}],266:[[[[10,1]],[[20,2]],[[69,3],[28,4]],[[70,5]],[[51,6],[71,7]],[[0,5]],[[69,3]],[[51,6]]],{10:1}],267:[[[[72,1],[73,1],[7,2],[74,1],[72,1],[75,1],[76,1],[77,3],[78,1],[79,1]],[[0,1]],
[[75,1]],[[7,1],[0,3]]],{7:1,72:1,73:1,74:1,75:1,76:1,77:1,78:1,79:1}],268:[[[[80,1]],[[81,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],269:[[[[82,1],[83,1],[84,1],[85,1],[86,1],[87,1],[88,1],[89,1]],[[0,1]]],{4:1,10:1,14:1,16:1,27:1,30:1,33:1,34:1}],270:[[[[32,1]],[[0,1]]],{32:1}],271:[[[[90,1]],[[88,2],[85,2]],[[0,2]]],{33:1}],272:[[[[33,1]],[[91,2]],[[28,4],[2,3]],[[0,3]],[[51,5],[92,6]],[[2,3]],[[51,5]]],{33:1}],273:[[[[93,1]],[[93,1],[0,1]]],{33:1}],274:[[[[21,1]],[[94,2]],[[0,
2]]],{21:1}],275:[[[[44,1]],[[69,2]],[[44,3]],[[45,4],[0,3]],[[44,1],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],276:[[[[91,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],{20:1}],277:[[[[96,1]],[[45,0],[0,1]]],{20:1}],278:[[[[20,1]],[[97,0],[0,1]]],{20:1}],279:[[[[20,1]],[[0,1]]],{20:1}],280:[[[[71,1]],[[2,1],[98,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],281:[[[[99,1]],[[44,2],[0,1]],[[95,3],[45,3],[0,2]],[[44,4]],[[0,4]]],{99:1}],282:[[[[15,1]],[[80,2]],
[[75,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],{15:1}],283:[[[[100,1]],[[101,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],284:[[[[71,1]],[[102,2],[47,3],[0,1]],[[71,4],[53,4]],[[71,5],[53,5]],[[0,4]],[[47,3],[0,5]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],285:[[[[80,1]],[[45,2],[0,1]],[[80,1],[0,2]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],286:[[[[103,2],[24,1],[6,1],[35,1]],[[104,2]],[[0,2]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],
287:[[[[2,0],[98,1],[105,0]],[[0,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,98:1}],288:[[[[106,1],[107,1],[108,1],[109,1],[110,1]],[[0,1]]],{5:1,18:1,25:1,31:1,32:1}],289:[[[[27,1]],[[94,2]],[[75,3]],[[71,4]],[[69,5]],[[70,6]],[[111,7],[0,6]],[[69,8]],[[70,9]],[[0,9]]],{27:1}],290:[[[[28,1],[20,2]],[[112,3]],[[0,2]],[[51,2]]],{20:1,28:1}],291:[[[[113,1]],[[45,2],[0,1]],[[113,
1],[0,2]]],{20:1,28:1}],292:[[[[4,1]],[[20,2]],[[114,3]],[[69,4]],[[70,5]],[[0,5]]],{4:1}],293:[[[[27,1]],[[94,2]],[[75,3]],[[115,4]],[[116,5],[0,4]],[[0,5]]],{27:1}],294:[[[[30,1]],[[117,2]],[[116,3],[0,2]],[[0,3]]],{30:1}],295:[[[[46,1],[118,1]],[[0,1]]],{27:1,30:1}],296:[[[[26,1]],[[20,2]],[[45,1],[0,2]]],{26:1}],297:[[[[30,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[119,1],[0,4]],[[69,6]],[[70,7]],[[0,7]]],{30:1}],298:[[[[20,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],{20:1}],299:[[[[120,1]],[[45,2],[0,
1]],[[120,1],[0,2]]],{20:1}],300:[[[[29,1]],[[91,2],[97,3]],[[23,4]],[[91,2],[23,4],[97,3]],[[121,5],[41,5],[28,6]],[[0,5]],[[121,7]],[[51,5]]],{29:1}],301:[[[[23,1]],[[122,2]],[[0,2]]],{23:1}],302:[[[[123,1],[124,1]],[[0,1]]],{23:1,29:1}],303:[[[[36,1]],[[69,2],[125,3]],[[44,4]],[[69,2]],[[0,4]]],{36:1}],304:[[[[27,1]],[[94,2]],[[75,3]],[[126,4]],[[127,5],[0,4]],[[0,5]]],{27:1}],305:[[[[30,1]],[[117,2]],[[127,3],[0,2]],[[0,3]]],{30:1}],306:[[[[128,1],[129,1]],[[0,1]]],{27:1,30:1}],307:[[[[44,1]],
[[128,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],308:[[[[7,1],[130,2]],[[39,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],309:[[[[36,1]],[[69,2],[125,3]],[[117,4]],[[69,2]],[[0,4]]],{36:1}],310:[[[[131,1],[115,1]],[[0,1]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],311:[[[[132,1]],[[133,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],312:[[[[28,1]],[[51,2],[125,3]],[[0,2]],
[[51,2]]],{28:1}],313:[[[[22,1]],[[0,1]]],{22:1}],314:[[[[134,1]],[[135,1],[43,2],[0,1]],[[104,3]],[[0,3]]],{8:1,9:1,11:1,13:1,17:1,20:1,28:1}],315:[[[[12,1]],[[44,2],[136,3],[0,1]],[[45,4],[0,2]],[[44,5]],[[44,2],[0,4]],[[45,6],[0,5]],[[44,7]],[[45,8],[0,7]],[[44,7],[0,8]]],{12:1}],316:[[[[5,1]],[[44,2],[0,1]],[[45,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],{5:1}],317:[[[[18,1]],[[71,2],[0,1]],[[0,2]]],{18:1}],318:[[[[137,1]],[[136,0],[138,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,
28:1,35:1}],319:[[[[139,1]],[[2,2],[140,3]],[[0,2]],[[139,1],[2,2]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,15:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,28:1,29:1,31:1,32:1,35:1,36:1}],320:[[[[69,1]],[[44,2],[0,1]],[[0,2]]],{69:1}],321:[[[[141,1],[142,1],[143,1],[144,1],[145,1],[146,1],[147,1],[148,1],[149,1]],[[0,1]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,15:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,28:1,29:1,31:1,32:1,35:1,36:1}],322:[[[[1,1],[3,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,
9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1}],323:[[[[44,1],[69,2],[97,3]],[[69,2],[0,1]],[[44,4],[150,5],[0,2]],[[97,6]],[[150,5],[0,4]],[[0,5]],[[97,5]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1,69:1,97:1}],324:[[[[151,1]],[[45,2],[0,1]],[[151,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1,69:1,97:1}],325:[[[[1,1],[2,2]],[[0,1]],[[152,3]],[[105,4]],[[153,1],[105,4]]],
{2:1,5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,15:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,28:1,29:1,31:1,32:1,35:1,36:1}],326:[[[[104,1]],[[154,0],[41,0],[155,0],[156,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],327:[[[[115,1],[157,2]],[[30,3],[0,1]],[[0,2]],[[115,4]],[[111,5]],[[44,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],328:[[[[44,1]],[[45,2],[0,1]],[[44,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],329:[[[[44,1]],[[45,0],[0,1]]],
{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],330:[[[[44,1]],[[46,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],331:[[[[117,1]],[[45,2],[0,1]],[[117,3]],[[45,4],[0,3]],[[117,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],332:[[[[28,1],[97,2],[11,3]],[[51,4],[92,5]],[[20,4]],[[158,6]],[[0,4]],[[51,4]],[[50,4]]],{11:1,28:1,97:1}],333:[[[[14,1]],[[69,2]],[[70,3]],[[159,4],[160,5]],[[69,6]],[[69,7]],
[[70,8]],[[70,9]],[[159,4],[111,10],[160,5],[0,8]],[[0,9]],[[69,11]],[[70,12]],[[160,5],[0,12]]],{14:1}],334:[[[[41,1],[113,2],[43,3]],[[20,4]],[[47,5],[45,6],[0,2]],[[20,7]],[[45,8],[0,4]],[[44,9]],[[41,1],[113,2],[43,3],[0,6]],[[0,7]],[[43,3]],[[45,6],[0,9]]],{20:1,28:1,41:1,43:1}],335:[[[[16,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[0,4]],[[69,6]],[[70,7]],[[0,7]]],{16:1}],336:[[[[34,1]],[[44,2]],[[69,3],[161,4]],[[70,5]],[[69,3]],[[0,5]]],{34:1}],337:[[[[95,1]],[[80,2]],[[0,2]]],{95:1}],338:[[[[162,
1]],[[163,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],339:[[[[25,1]],[[71,2],[0,1]],[[0,2]]],{25:1}],340:[[[[53,1]],[[0,1]]],{25:1}]},states:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],[[[37,1]],[[38,0],[0,1]]],[[[39,1]],[[40,0],[0,1]]],[[[41,1],[42,2],[43,3]],[[44,4]],[[45,5],[0,2]],[[44,6]],[[45,7],[0,4]],[[41,1],[42,2],[43,3],[0,5]],[[0,6]],[[42,4],[43,3]]],[[[44,1]],[[46,2],[47,3],[0,1]],[[0,2]],[[44,2]]],[[[48,1]],[[24,0],[35,0],[0,1]]],[[[19,1]],[[44,2]],[[45,3],[0,2]],[[44,4]],
[[0,4]]],[[[17,1],[8,2],[9,5],[28,4],[11,3],[13,6],[20,2]],[[17,1],[0,1]],[[0,2]],[[49,7],[50,2]],[[51,2],[52,8],[53,8]],[[54,9],[55,2]],[[56,10]],[[50,2]],[[51,2]],[[55,2]],[[13,2]]],[[[57,1],[58,1],[59,1],[60,1],[61,1],[62,1],[63,1],[64,1],[65,1],[66,1],[67,1],[68,1]],[[0,1]]],[[[31,1]],[[0,1]]],[[[10,1]],[[20,2]],[[69,3],[28,4]],[[70,5]],[[51,6],[71,7]],[[0,5]],[[69,3]],[[51,6]]],[[[72,1],[73,1],[7,2],[74,1],[72,1],[75,1],[76,1],[77,3],[78,1],[79,1]],[[0,1]],[[75,1]],[[7,1],[0,3]]],[[[80,1]],[[81,
0],[0,1]]],[[[82,1],[83,1],[84,1],[85,1],[86,1],[87,1],[88,1],[89,1]],[[0,1]]],[[[32,1]],[[0,1]]],[[[90,1]],[[88,2],[85,2]],[[0,2]]],[[[33,1]],[[91,2]],[[28,4],[2,3]],[[0,3]],[[51,5],[92,6]],[[2,3]],[[51,5]]],[[[93,1]],[[93,1],[0,1]]],[[[21,1]],[[94,2]],[[0,2]]],[[[44,1]],[[69,2]],[[44,3]],[[45,4],[0,3]],[[44,1],[0,4]]],[[[91,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],[[[96,1]],[[45,0],[0,1]]],[[[20,1]],[[97,0],[0,1]]],[[[20,1]],[[0,1]]],[[[71,1]],[[2,1],[98,2]],[[0,2]]],[[[99,1]],[[44,2],[0,1]],[[95,3],
[45,3],[0,2]],[[44,4]],[[0,4]]],[[[15,1]],[[80,2]],[[75,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],[[[100,1]],[[101,0],[0,1]]],[[[71,1]],[[102,2],[47,3],[0,1]],[[71,4],[53,4]],[[71,5],[53,5]],[[0,4]],[[47,3],[0,5]]],[[[80,1]],[[45,2],[0,1]],[[80,1],[0,2]]],[[[103,2],[24,1],[6,1],[35,1]],[[104,2]],[[0,2]]],[[[2,0],[98,1],[105,0]],[[0,1]]],[[[106,1],[107,1],[108,1],[109,1],[110,1]],[[0,1]]],[[[27,1]],[[94,2]],[[75,3]],[[71,4]],[[69,5]],[[70,6]],[[111,7],[0,6]],[[69,8]],[[70,9]],[[0,9]]],[[[28,
1],[20,2]],[[112,3]],[[0,2]],[[51,2]]],[[[113,1]],[[45,2],[0,1]],[[113,1],[0,2]]],[[[4,1]],[[20,2]],[[114,3]],[[69,4]],[[70,5]],[[0,5]]],[[[27,1]],[[94,2]],[[75,3]],[[115,4]],[[116,5],[0,4]],[[0,5]]],[[[30,1]],[[117,2]],[[116,3],[0,2]],[[0,3]]],[[[46,1],[118,1]],[[0,1]]],[[[26,1]],[[20,2]],[[45,1],[0,2]]],[[[30,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[119,1],[0,4]],[[69,6]],[[70,7]],[[0,7]]],[[[20,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],[[[120,1]],[[45,2],[0,1]],[[120,1],[0,2]]],[[[29,1]],[[91,2],[97,
3]],[[23,4]],[[91,2],[23,4],[97,3]],[[121,5],[41,5],[28,6]],[[0,5]],[[121,7]],[[51,5]]],[[[23,1]],[[122,2]],[[0,2]]],[[[123,1],[124,1]],[[0,1]]],[[[36,1]],[[69,2],[125,3]],[[44,4]],[[69,2]],[[0,4]]],[[[27,1]],[[94,2]],[[75,3]],[[126,4]],[[127,5],[0,4]],[[0,5]]],[[[30,1]],[[117,2]],[[127,3],[0,2]],[[0,3]]],[[[128,1],[129,1]],[[0,1]]],[[[44,1]],[[128,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],[[[7,1],[130,2]],[[39,2]],[[0,2]]],[[[36,1]],[[69,2],[125,3]],[[117,4]],[[69,2]],[[0,4]]],[[[131,
1],[115,1]],[[0,1]]],[[[132,1]],[[133,0],[0,1]]],[[[28,1]],[[51,2],[125,3]],[[0,2]],[[51,2]]],[[[22,1]],[[0,1]]],[[[134,1]],[[135,1],[43,2],[0,1]],[[104,3]],[[0,3]]],[[[12,1]],[[44,2],[136,3],[0,1]],[[45,4],[0,2]],[[44,5]],[[44,2],[0,4]],[[45,6],[0,5]],[[44,7]],[[45,8],[0,7]],[[44,7],[0,8]]],[[[5,1]],[[44,2],[0,1]],[[45,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],[[[18,1]],[[71,2],[0,1]],[[0,2]]],[[[137,1]],[[136,0],[138,0],[0,1]]],[[[139,1]],[[2,2],[140,3]],[[0,2]],[[139,1],[2,2]]],[[[69,
1]],[[44,2],[0,1]],[[0,2]]],[[[141,1],[142,1],[143,1],[144,1],[145,1],[146,1],[147,1],[148,1],[149,1]],[[0,1]]],[[[1,1],[3,1]],[[0,1]]],[[[44,1],[69,2],[97,3]],[[69,2],[0,1]],[[44,4],[150,5],[0,2]],[[97,6]],[[150,5],[0,4]],[[0,5]],[[97,5]]],[[[151,1]],[[45,2],[0,1]],[[151,1],[0,2]]],[[[1,1],[2,2]],[[0,1]],[[152,3]],[[105,4]],[[153,1],[105,4]]],[[[104,1]],[[154,0],[41,0],[155,0],[156,0],[0,1]]],[[[115,1],[157,2]],[[30,3],[0,1]],[[0,2]],[[115,4]],[[111,5]],[[44,2]]],[[[44,1]],[[45,2],[0,1]],[[44,1],
[0,2]]],[[[44,1]],[[45,0],[0,1]]],[[[44,1]],[[46,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],[[[117,1]],[[45,2],[0,1]],[[117,3]],[[45,4],[0,3]],[[117,3],[0,4]]],[[[28,1],[97,2],[11,3]],[[51,4],[92,5]],[[20,4]],[[158,6]],[[0,4]],[[51,4]],[[50,4]]],[[[14,1]],[[69,2]],[[70,3]],[[159,4],[160,5]],[[69,6]],[[69,7]],[[70,8]],[[70,9]],[[159,4],[111,10],[160,5],[0,8]],[[0,9]],[[69,11]],[[70,12]],[[160,5],[0,12]]],[[[41,1],[113,2],[43,3]],[[20,4]],[[47,5],[45,6],[0,2]],[[20,7]],[[45,8],[0,4]],[[44,
9]],[[41,1],[113,2],[43,3],[0,6]],[[0,7]],[[43,3]],[[45,6],[0,9]]],[[[16,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[0,4]],[[69,6]],[[70,7]],[[0,7]]],[[[34,1]],[[44,2]],[[69,3],[161,4]],[[70,5]],[[69,3]],[[0,5]]],[[[95,1]],[[80,2]],[[0,2]]],[[[162,1]],[[163,0],[0,1]]],[[[25,1]],[[71,2],[0,1]],[[0,2]]],[[[53,1]],[[0,1]]]],labels:[[0,"EMPTY"],[319,null],[4,null],[269,null],[1,"def"],[1,"raise"],[32,null],[1,"not"],[2,null],[26,null],[1,"class"],[9,null],[1,"print"],[25,null],[1,"try"],[1,"exec"],[1,"while"],
[3,null],[1,"return"],[1,"assert"],[1,null],[1,"del"],[1,"pass"],[1,"import"],[15,null],[1,"yield"],[1,"global"],[1,"for"],[7,null],[1,"from"],[1,"if"],[1,"break"],[1,"continue"],[50,null],[1,"with"],[14,null],[1,"lambda"],[318,null],[19,null],[308,null],[1,"and"],[16,null],[260,null],[36,null],[327,null],[12,null],[293,null],[22,null],[326,null],[307,null],[10,null],[8,null],[330,null],[339,null],[275,null],[27,null],[329,null],[46,null],[39,null],[41,null],[47,null],[42,null],[43,null],[37,null],
[44,null],[49,null],[40,null],[38,null],[45,null],[11,null],[325,null],[328,null],[29,null],[21,null],[28,null],[1,"in"],[30,null],[1,"is"],[31,null],[20,null],[283,null],[267,null],[333,null],[297,null],[289,null],[266,null],[336,null],[335,null],[292,null],[271,null],[273,null],[278,null],[259,null],[272,null],[285,null],[1,"as"],[276,null],[23,null],[0,null],[1,"except"],[338,null],[18,null],[264,null],[314,null],[286,null],[322,null],[265,null],[270,null],[316,null],[317,null],[340,null],[1,"else"],
[291,null],[290,null],[312,null],[311,null],[295,null],[310,null],[294,null],[1,"elif"],[298,null],[299,null],[277,null],[301,null],[300,null],[334,null],[331,null],[306,null],[304,null],[305,null],[268,null],[309,null],[258,null],[1,"or"],[263,null],[332,null],[35,null],[261,null],[34,null],[321,null],[13,null],[288,null],[262,null],[284,null],[313,null],[315,null],[274,null],[282,null],[296,null],[302,null],[320,null],[323,null],[5,null],[6,null],[48,null],[17,null],[24,null],[303,null],[324,null],
[281,null],[1,"finally"],[337,null],[257,null],[33,null]],keywords:{and:40,as:95,assert:19,"break":31,"class":10,"continue":32,def:4,del:21,elif:119,"else":111,except:99,exec:15,"finally":160,"for":27,from:29,global:26,"if":30,"import":23,"in":75,is:77,lambda:36,not:7,or:133,pass:22,print:12,raise:5,"return":18,"try":14,"while":16,"with":34,yield:25},tokens:{0:98,1:20,2:8,3:17,4:2,5:152,6:153,7:28,8:51,9:11,10:50,11:69,12:45,13:140,14:35,15:24,16:41,17:155,18:101,19:38,20:79,21:73,22:47,23:97,24:156,
25:13,26:9,27:55,28:74,29:72,30:76,31:78,32:6,33:163,34:138,35:136,36:43,37:63,38:67,39:58,40:66,41:59,42:61,43:62,44:64,45:68,46:57,47:60,48:154,49:65,50:33},start:256};function Parser(a){this.grammar=a;return this}Parser.prototype.setup=function(a){a=a||this.grammar.start;this.stack=[{dfa:this.grammar.dfas[a],state:0,node:{type:a,value:null,context:null,children:[]}}];this.used_names={}};function findInDfa(a,b){for(var c=a.length;c--;)if(a[c][0]===b[0]&&a[c][1]===b[1])return true;return false}
Parser.prototype.addtoken=function(a,b,c){var d=this.classify(a,b,c);a:for(;;){for(var e=this.stack[this.stack.length-1],f=e.dfa[0],g=f[e.state],h=0;h<g.length;++h){var i=g[h][0],j=g[h][1],k=this.grammar.labels[i][0];if(d===i){goog.asserts.assert(k<256);this.shift(a,b,j,c);for(a=j;f[a].length===1&&f[a][0][0]===0&&f[a][0][1]===a;){this.pop();if(this.stack.length===0)return true;e=this.stack[this.stack.length-1];a=e.state;f=e.dfa[0]}return false}else if(k>=256)if(this.grammar.dfas[k][1].hasOwnProperty(d)){this.push(k,
this.grammar.dfas[k],j,c);continue a}}if(findInDfa(g,[0,e.state])){this.pop();if(this.stack.length===0)throw new Sk.builtin.ParseError("too much input");}else throw new Sk.builtin.ParseError("bad input");}};
Parser.prototype.classify=function(a,b,c){var d;if(a===Sk.Tokenizer.Tokens.T_NAME){this.used_names[b]=true;if(d=this.grammar.keywords.hasOwnProperty(b)&&this.grammar.keywords[b])return d}d=this.grammar.tokens.hasOwnProperty(a)&&this.grammar.tokens[a];if(!d)throw new Sk.builtin.ParseError("bad token",a,b,c);return d};
Parser.prototype.shift=function(a,b,c,d){var e=this.stack[this.stack.length-1].dfa,f=this.stack[this.stack.length-1].node;f.children.push({type:a,value:b,lineno:d[0][0],col_offset:d[0][1],children:null});this.stack[this.stack.length-1]={dfa:e,state:c,node:f}};
Parser.prototype.push=function(a,b,c,d){a={type:a,value:null,lineno:d[0][0],col_offset:d[0][1],children:[]};this.stack[this.stack.length-1]={dfa:this.stack[this.stack.length-1].dfa,state:c,node:this.stack[this.stack.length-1].node};this.stack.push({dfa:b,state:0,node:a})};Parser.prototype.pop=function(){var a=this.stack.pop().node;if(a)if(this.stack.length!==0)this.stack[this.stack.length-1].node.children.push(a);else{this.rootnode=a;this.rootnode.used_names=this.used_names}};
function makeParser(a,b){if(b===undefined)b="file_input";var c=new Parser(Sk.ParseTables);b==="file_input"?c.setup(Sk.ParseTables.sym.file_input):goog.asserts.fail("todo;");var d=1,e="",f=Sk.Tokenizer.Tokens.T_COMMENT,g=Sk.Tokenizer.Tokens.T_NL,h=Sk.Tokenizer.Tokens.T_OP,i=new Sk.Tokenizer(a,b==="single_input",function(j,k,l,n,p){if(j===f||j===g){e+=k;d=n[0];if(k[k.length-1]==="\n")d+=1}else{if(j===h)j=Sk.OpMap[k];if(c.addtoken(j,k,[l,n,p]))return true}});return function(j){if(j=i.generateTokens(j)){if(j!==
"done")throw"ParseError: incomplete input";return c.rootnode}return false}}Sk.parse=function(a,b){var c=makeParser(a);if(b.substr(b.length-1,1)!=="\n")b+="\n";for(var d=b.split("\n"),e,f=0;f<d.length;++f)e=c(d[f]+(f===d.length-1?"":"\n"));return e};
Sk.parseTreeDump=function(a,b){b=b||"";var c="";c+=b;if(a.type>=256){c+=Sk.ParseTables.number2symbol[a.type]+"\n";for(var d=0;d<a.children.length;++d)c+=Sk.parseTreeDump(a.children[d],b+" ")}else c+=Sk.Tokenizer.tokenNames[a.type]+": "+(new Sk.builtin.str(a.value)).$r().v+"\n";return c};goog.exportSymbol("Sk.parse",Sk.parse);goog.exportSymbol("Sk.parseTreeDump",Sk.parseTreeDump);function Load(){}function Store(){}function Del(){}function AugLoad(){}function AugStore(){}function Param(){}function And(){}function Or(){}function Add(){}function Sub(){}function Mult(){}function Div(){}function Mod(){}function Pow(){}function LShift(){}function RShift(){}function BitOr(){}function BitXor(){}function BitAnd(){}function FloorDiv(){}function Invert(){}function Not(){}function UAdd(){}function USub(){}function Eq(){}function NotEq(){}function Lt(){}function LtE(){}
function Gt(){}function GtE(){}function Is(){}function IsNot(){}function In_(){}function NotIn(){}function Module(a){this.body=a;return this}function Interactive(a){this.body=a;return this}function Expression(a){goog.asserts.assert(a!==null&&a!==undefined);this.body=a;return this}function Suite(a){this.body=a;return this}
function FunctionDef(a,b,c,d,e,f){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);this.name=a;this.args=b;this.body=c;this.decorator_list=d;this.lineno=e;this.col_offset=f;return this}function ClassDef(a,b,c,d,e,f){goog.asserts.assert(a!==null&&a!==undefined);this.name=a;this.bases=b;this.body=c;this.decorator_list=d;this.lineno=e;this.col_offset=f;return this}function Return_(a,b,c){this.value=a;this.lineno=b;this.col_offset=c;return this}
function Delete_(a,b,c){this.targets=a;this.lineno=b;this.col_offset=c;return this}function Assign(a,b,c,d){goog.asserts.assert(b!==null&&b!==undefined);this.targets=a;this.value=b;this.lineno=c;this.col_offset=d;return this}function AugAssign(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);goog.asserts.assert(c!==null&&c!==undefined);this.target=a;this.op=b;this.value=c;this.lineno=d;this.col_offset=e;return this}
function Print(a,b,c,d,e){this.dest=a;this.values=b;this.nl=c;this.lineno=d;this.col_offset=e;return this}function For_(a,b,c,d,e,f){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);this.target=a;this.iter=b;this.body=c;this.orelse=d;this.lineno=e;this.col_offset=f;return this}function While_(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}
function If_(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}function With_(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);this.context_expr=a;this.optional_vars=b;this.body=c;this.lineno=d;this.col_offset=e;return this}function Raise(a,b,c,d,e){this.type=a;this.inst=b;this.tback=c;this.lineno=d;this.col_offset=e;return this}
function TryExcept(a,b,c,d,e){this.body=a;this.handlers=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}function TryFinally(a,b,c,d){this.body=a;this.finalbody=b;this.lineno=c;this.col_offset=d;return this}function Assert(a,b,c,d){goog.asserts.assert(a!==null&&a!==undefined);this.test=a;this.msg=b;this.lineno=c;this.col_offset=d;return this}function Import_(a,b,c){this.names=a;this.lineno=b;this.col_offset=c;return this}
function ImportFrom(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);this.module=a;this.names=b;this.level=c;this.lineno=d;this.col_offset=e;return this}function Exec(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);this.body=a;this.globals=b;this.locals=c;this.lineno=d;this.col_offset=e;return this}function Global(a,b,c){this.names=a;this.lineno=b;this.col_offset=c;return this}
function Expr(a,b,c){goog.asserts.assert(a!==null&&a!==undefined);this.value=a;this.lineno=b;this.col_offset=c;return this}function Pass(a,b){this.lineno=a;this.col_offset=b;return this}function Break_(a,b){this.lineno=a;this.col_offset=b;return this}function Continue_(a,b){this.lineno=a;this.col_offset=b;return this}function BoolOp(a,b,c,d){goog.asserts.assert(a!==null&&a!==undefined);this.op=a;this.values=b;this.lineno=c;this.col_offset=d;return this}
function BinOp(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);goog.asserts.assert(c!==null&&c!==undefined);this.left=a;this.op=b;this.right=c;this.lineno=d;this.col_offset=e;return this}function UnaryOp(a,b,c,d){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);this.op=a;this.operand=b;this.lineno=c;this.col_offset=d;return this}
function Lambda(a,b,c,d){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);this.args=a;this.body=b;this.lineno=c;this.col_offset=d;return this}function IfExp(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);goog.asserts.assert(c!==null&&c!==undefined);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}
function Dict(a,b,c,d){this.keys=a;this.values=b;this.lineno=c;this.col_offset=d;return this}function ListComp(a,b,c,d){goog.asserts.assert(a!==null&&a!==undefined);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this}function GeneratorExp(a,b,c,d){goog.asserts.assert(a!==null&&a!==undefined);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this}function Yield(a,b,c){this.value=a;this.lineno=b;this.col_offset=c;return this}
function Compare(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);this.left=a;this.ops=b;this.comparators=c;this.lineno=d;this.col_offset=e;return this}function Call(a,b,c,d,e,f,g){goog.asserts.assert(a!==null&&a!==undefined);this.func=a;this.args=b;this.keywords=c;this.starargs=d;this.kwargs=e;this.lineno=f;this.col_offset=g;return this}function Num(a,b,c){goog.asserts.assert(a!==null&&a!==undefined);this.n=a;this.lineno=b;this.col_offset=c;return this}
function Str(a,b,c){goog.asserts.assert(a!==null&&a!==undefined);this.s=a;this.lineno=b;this.col_offset=c;return this}function Attribute(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);goog.asserts.assert(c!==null&&c!==undefined);this.value=a;this.attr=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this}
function Subscript(a,b,c,d,e){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);goog.asserts.assert(c!==null&&c!==undefined);this.value=a;this.slice=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this}function Name(a,b,c,d){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);this.id=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}
function List(a,b,c,d){goog.asserts.assert(b!==null&&b!==undefined);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}function Tuple(a,b,c,d){goog.asserts.assert(b!==null&&b!==undefined);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}function Ellipsis(){return this}function Slice(a,b,c){this.lower=a;this.upper=b;this.step=c;return this}function ExtSlice(a){this.dims=a;return this}
function Index(a){goog.asserts.assert(a!==null&&a!==undefined);this.value=a;return this}function comprehension(a,b,c){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);this.target=a;this.iter=b;this.ifs=c;return this}function ExceptHandler(a,b,c,d,e){this.type=a;this.name=b;this.body=c;this.lineno=d;this.col_offset=e;return this}function arguments_(a,b,c,d){this.args=a;this.vararg=b;this.kwarg=c;this.defaults=d;return this}
function keyword(a,b){goog.asserts.assert(a!==null&&a!==undefined);goog.asserts.assert(b!==null&&b!==undefined);this.arg=a;this.value=b;return this}function alias(a,b){goog.asserts.assert(a!==null&&a!==undefined);this.name=a;this.asname=b;return this}Module.prototype._astname="Module";Module.prototype._fields=["body",function(a){return a.body}];Interactive.prototype._astname="Interactive";Interactive.prototype._fields=["body",function(a){return a.body}];Expression.prototype._astname="Expression";
Expression.prototype._fields=["body",function(a){return a.body}];Suite.prototype._astname="Suite";Suite.prototype._fields=["body",function(a){return a.body}];FunctionDef.prototype._astname="FunctionDef";FunctionDef.prototype._fields=["name",function(a){return a.name},"args",function(a){return a.args},"body",function(a){return a.body},"decorator_list",function(a){return a.decorator_list}];ClassDef.prototype._astname="ClassDef";
ClassDef.prototype._fields=["name",function(a){return a.name},"bases",function(a){return a.bases},"body",function(a){return a.body},"decorator_list",function(a){return a.decorator_list}];Return_.prototype._astname="Return";Return_.prototype._fields=["value",function(a){return a.value}];Delete_.prototype._astname="Delete";Delete_.prototype._fields=["targets",function(a){return a.targets}];Assign.prototype._astname="Assign";Assign.prototype._fields=["targets",function(a){return a.targets},"value",function(a){return a.value}];
AugAssign.prototype._astname="AugAssign";AugAssign.prototype._fields=["target",function(a){return a.target},"op",function(a){return a.op},"value",function(a){return a.value}];Print.prototype._astname="Print";Print.prototype._fields=["dest",function(a){return a.dest},"values",function(a){return a.values},"nl",function(a){return a.nl}];For_.prototype._astname="For";
For_.prototype._fields=["target",function(a){return a.target},"iter",function(a){return a.iter},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];While_.prototype._astname="While";While_.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];If_.prototype._astname="If";If_.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];
With_.prototype._astname="With";With_.prototype._fields=["context_expr",function(a){return a.context_expr},"optional_vars",function(a){return a.optional_vars},"body",function(a){return a.body}];Raise.prototype._astname="Raise";Raise.prototype._fields=["type",function(a){return a.type},"inst",function(a){return a.inst},"tback",function(a){return a.tback}];TryExcept.prototype._astname="TryExcept";
TryExcept.prototype._fields=["body",function(a){return a.body},"handlers",function(a){return a.handlers},"orelse",function(a){return a.orelse}];TryFinally.prototype._astname="TryFinally";TryFinally.prototype._fields=["body",function(a){return a.body},"finalbody",function(a){return a.finalbody}];Assert.prototype._astname="Assert";Assert.prototype._fields=["test",function(a){return a.test},"msg",function(a){return a.msg}];Import_.prototype._astname="Import";Import_.prototype._fields=["names",function(a){return a.names}];
ImportFrom.prototype._astname="ImportFrom";ImportFrom.prototype._fields=["module",function(a){return a.module},"names",function(a){return a.names},"level",function(a){return a.level}];Exec.prototype._astname="Exec";Exec.prototype._fields=["body",function(a){return a.body},"globals",function(a){return a.globals},"locals",function(a){return a.locals}];Global.prototype._astname="Global";Global.prototype._fields=["names",function(a){return a.names}];Expr.prototype._astname="Expr";
Expr.prototype._fields=["value",function(a){return a.value}];Pass.prototype._astname="Pass";Pass.prototype._fields=[];Break_.prototype._astname="Break";Break_.prototype._fields=[];Continue_.prototype._astname="Continue";Continue_.prototype._fields=[];BoolOp.prototype._astname="BoolOp";BoolOp.prototype._fields=["op",function(a){return a.op},"values",function(a){return a.values}];BinOp.prototype._astname="BinOp";
BinOp.prototype._fields=["left",function(a){return a.left},"op",function(a){return a.op},"right",function(a){return a.right}];UnaryOp.prototype._astname="UnaryOp";UnaryOp.prototype._fields=["op",function(a){return a.op},"operand",function(a){return a.operand}];Lambda.prototype._astname="Lambda";Lambda.prototype._fields=["args",function(a){return a.args},"body",function(a){return a.body}];IfExp.prototype._astname="IfExp";
IfExp.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];Dict.prototype._astname="Dict";Dict.prototype._fields=["keys",function(a){return a.keys},"values",function(a){return a.values}];ListComp.prototype._astname="ListComp";ListComp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];GeneratorExp.prototype._astname="GeneratorExp";
GeneratorExp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];Yield.prototype._astname="Yield";Yield.prototype._fields=["value",function(a){return a.value}];Compare.prototype._astname="Compare";Compare.prototype._fields=["left",function(a){return a.left},"ops",function(a){return a.ops},"comparators",function(a){return a.comparators}];Call.prototype._astname="Call";
Call.prototype._fields=["func",function(a){return a.func},"args",function(a){return a.args},"keywords",function(a){return a.keywords},"starargs",function(a){return a.starargs},"kwargs",function(a){return a.kwargs}];Num.prototype._astname="Num";Num.prototype._fields=["n",function(a){return a.n}];Str.prototype._astname="Str";Str.prototype._fields=["s",function(a){return a.s}];Attribute.prototype._astname="Attribute";
Attribute.prototype._fields=["value",function(a){return a.value},"attr",function(a){return a.attr},"ctx",function(a){return a.ctx}];Subscript.prototype._astname="Subscript";Subscript.prototype._fields=["value",function(a){return a.value},"slice",function(a){return a.slice},"ctx",function(a){return a.ctx}];Name.prototype._astname="Name";Name.prototype._fields=["id",function(a){return a.id},"ctx",function(a){return a.ctx}];List.prototype._astname="List";
List.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];Tuple.prototype._astname="Tuple";Tuple.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];Load.prototype._astname="Load";Load.prototype._isenum=true;Store.prototype._astname="Store";Store.prototype._isenum=true;Del.prototype._astname="Del";Del.prototype._isenum=true;AugLoad.prototype._astname="AugLoad";AugLoad.prototype._isenum=true;AugStore.prototype._astname="AugStore";
AugStore.prototype._isenum=true;Param.prototype._astname="Param";Param.prototype._isenum=true;Ellipsis.prototype._astname="Ellipsis";Ellipsis.prototype._fields=[];Slice.prototype._astname="Slice";Slice.prototype._fields=["lower",function(a){return a.lower},"upper",function(a){return a.upper},"step",function(a){return a.step}];ExtSlice.prototype._astname="ExtSlice";ExtSlice.prototype._fields=["dims",function(a){return a.dims}];Index.prototype._astname="Index";Index.prototype._fields=["value",function(a){return a.value}];
And.prototype._astname="And";And.prototype._isenum=true;Or.prototype._astname="Or";Or.prototype._isenum=true;Add.prototype._astname="Add";Add.prototype._isenum=true;Sub.prototype._astname="Sub";Sub.prototype._isenum=true;Mult.prototype._astname="Mult";Mult.prototype._isenum=true;Div.prototype._astname="Div";Div.prototype._isenum=true;Mod.prototype._astname="Mod";Mod.prototype._isenum=true;Pow.prototype._astname="Pow";Pow.prototype._isenum=true;LShift.prototype._astname="LShift";
LShift.prototype._isenum=true;RShift.prototype._astname="RShift";RShift.prototype._isenum=true;BitOr.prototype._astname="BitOr";BitOr.prototype._isenum=true;BitXor.prototype._astname="BitXor";BitXor.prototype._isenum=true;BitAnd.prototype._astname="BitAnd";BitAnd.prototype._isenum=true;FloorDiv.prototype._astname="FloorDiv";FloorDiv.prototype._isenum=true;Invert.prototype._astname="Invert";Invert.prototype._isenum=true;Not.prototype._astname="Not";Not.prototype._isenum=true;
UAdd.prototype._astname="UAdd";UAdd.prototype._isenum=true;USub.prototype._astname="USub";USub.prototype._isenum=true;Eq.prototype._astname="Eq";Eq.prototype._isenum=true;NotEq.prototype._astname="NotEq";NotEq.prototype._isenum=true;Lt.prototype._astname="Lt";Lt.prototype._isenum=true;LtE.prototype._astname="LtE";LtE.prototype._isenum=true;Gt.prototype._astname="Gt";Gt.prototype._isenum=true;GtE.prototype._astname="GtE";GtE.prototype._isenum=true;Is.prototype._astname="Is";Is.prototype._isenum=true;
IsNot.prototype._astname="IsNot";IsNot.prototype._isenum=true;In_.prototype._astname="In";In_.prototype._isenum=true;NotIn.prototype._astname="NotIn";NotIn.prototype._isenum=true;comprehension.prototype._astname="comprehension";comprehension.prototype._fields=["target",function(a){return a.target},"iter",function(a){return a.iter},"ifs",function(a){return a.ifs}];ExceptHandler.prototype._astname="ExceptHandler";
ExceptHandler.prototype._fields=["type",function(a){return a.type},"name",function(a){return a.name},"body",function(a){return a.body}];arguments_.prototype._astname="arguments";arguments_.prototype._fields=["args",function(a){return a.args},"vararg",function(a){return a.vararg},"kwarg",function(a){return a.kwarg},"defaults",function(a){return a.defaults}];keyword.prototype._astname="keyword";keyword.prototype._fields=["arg",function(a){return a.arg},"value",function(a){return a.value}];
alias.prototype._astname="alias";alias.prototype._fields=["name",function(a){return a.name},"asname",function(a){return a.asname}];var SYM=Sk.ParseTables.sym,TOK=Sk.Tokenizer.Tokens;function Compiling(a,b){this.c_encoding=a;this.c_filename=b}function NCH(a){goog.asserts.assert(a!==undefined);if(a.children===null)return 0;return a.children.length}function CHILD(a,b){goog.asserts.assert(a!==undefined);goog.asserts.assert(b!==undefined);return a.children[b]}function REQ(a,b){goog.asserts.assert(a.type===b,"node wasn't expected type")}
function strobj(a){goog.asserts.assert(typeof a==="string","expecting string, got "+typeof a);return new Sk.builtin.str(a)}
function numStmts(a){switch(a.type){case SYM.single_input:if(CHILD(a,0).type===TOK.T_NEWLINE)break;else return numStmts(CHILD(a,0));case SYM.file_input:for(var b=0,c=0;c<NCH(a);++c){var d=CHILD(a,c);if(d.type===SYM.stmt)b+=numStmts(d)}return b;case SYM.stmt:return numStmts(CHILD(a,0));case SYM.compound_stmt:return 1;case SYM.simple_stmt:return Math.floor(NCH(a)/2);case SYM.suite:if(NCH(a)===1)return numStmts(CHILD(a,0));else{b=0;for(c=2;c<NCH(a)-1;++c)b+=numStmts(CHILD(a,c));return b}default:goog.asserts.fail("Non-statement found")}return 0}
function forbiddenCheck(a,b,c){if(c==="None")throw new SyntaxError("assignment to None");if(c==="True"||c==="False")throw new SyntaxError("assignment to True or False is forbidden");}
function setContext(a,b,c,d){goog.asserts.assert(c!==AugStore&&c!==AugLoad);var e=null,f=null;switch(b.constructor){case Attribute:case Name:c===Store&&forbiddenCheck(a,d,b.attr);b.ctx=c;break;case Subscript:b.ctx=c;break;case List:b.ctx=c;e=b.elts;break;case Tuple:if(b.elts.length===0)throw new SyntaxError("can't assign to ()");b.ctx=c;e=b.elts;break;case Lambda:f="lambda";break;case Call:f="function call";break;case BoolOp:case BinOp:case UnaryOp:f="operator";break;case GeneratorExp:f="generator expression";
break;case Yield:f="yield expression";break;case ListComp:f="list comprehension";break;case Dict:case Num:case Str:f="literal";break;case Compare:f="comparison";break;case IfExp:f="conditional expression";break;default:goog.asserts.fail("unhandled expression in assignment")}if(f)throw new SyntaxError("can't "+(c===Store?"assign to":"delete")+" "+f);if(e)for(b=0;b<e.length;++b)setContext(a,e[b],c,d)}var operatorMap={};
(function(){operatorMap[TOK.T_VBAR]=BitOr;operatorMap[TOK.T_VBAR]=BitOr;operatorMap[TOK.T_CIRCUMFLEX]=BitXor;operatorMap[TOK.T_AMPER]=BitAnd;operatorMap[TOK.T_LEFTSHIFT]=LShift;operatorMap[TOK.T_RIGHTSHIFT]=RShift;operatorMap[TOK.T_PLUS]=Add;operatorMap[TOK.T_MINUS]=Sub;operatorMap[TOK.T_STAR]=Mult;operatorMap[TOK.T_SLASH]=Div;operatorMap[TOK.T_DOUBLESLASH]=FloorDiv;operatorMap[TOK.T_PERCENT]=Mod})();
function getOperator(a){goog.asserts.assert(operatorMap[a.type]!==undefined);return operatorMap[a.type]}
function astForCompOp(a,b){REQ(b,SYM.comp_op);if(NCH(b)===1){b=CHILD(b,0);switch(b.type){case TOK.T_LESS:return Lt;case TOK.T_GREATER:return Gt;case TOK.T_EQEQUAL:return Eq;case TOK.T_LESSEQUAL:return LtE;case TOK.T_GREATEREQUAL:return GtE;case TOK.T_NOTEQUAL:return NotEq;case TOK.T_NAME:if(b.value==="in")return In_;if(b.value==="is")return Is}}else if(NCH(b)===2)if(CHILD(b,0).type===TOK.T_NAME){if(CHILD(b,1).value==="in")return NotIn;if(CHILD(b,0).value==="is")return IsNot}goog.asserts.fail("invalid comp_op")}
function seqForTestlist(a,b){goog.asserts.assert(b.type===SYM.testlist||b.type===SYM.listmaker||b.type===SYM.testlist_gexp||b.type===SYM.testlist_safe||b.type===SYM.testlist1);for(var c=[],d=0;d<NCH(b);d+=2){goog.asserts.assert(CHILD(b,d).type===SYM.test||CHILD(b,d).type===SYM.old_test);c[d/2]=astForExpr(a,CHILD(b,d))}return c}
function astForSuite(a,b){REQ(b,SYM.suite);var c=[],d=0,e;if(CHILD(b,0).type===SYM.simple_stmt){b=CHILD(b,0);e=NCH(b)-1;if(CHILD(b,e-1).type===TOK.T_SEMI)e-=1;for(var f=0;f<e;f+=2)c[d++]=astForStmt(a,CHILD(b,f))}else for(f=2;f<NCH(b)-1;++f){e=CHILD(b,f);REQ(e,SYM.stmt);if(numStmts(e)===1)c[d++]=astForStmt(a,e);else{e=CHILD(e,0);REQ(e,SYM.simple_stmt);for(var g=0;g<NCH(e);g+=2){if(NCH(CHILD(e,g))===0){goog.asserts.assert(g+1===NCH(e));break}c[d++]=astForStmt(a,CHILD(e,g))}}}goog.asserts.assert(d===
numStmts(b));return c}
function astForExceptClause(a,b,c){REQ(b,SYM.except_clause);REQ(c,SYM.suite);if(NCH(b)===1)return new ExceptHandler(null,null,astForSuite(a,c),b.lineno,b.col_offset);else if(NCH(b)===2)return new ExceptHandler(astForExpr(a,CHILD(b,1)),null,astForSuite(a,c),b.lineno,b.col_offset);else if(NCH(b)===4){var d=astForExpr(a,CHILD(b,3));setContext(a,d,Store,CHILD(b,3));return new ExceptHandler(astForExpr(a,CHILD(b,1)),d,astForSuite(a,c),b.lineno,b.col_offset)}goog.asserts.fail("wrong number of children for except clause")}
function astForTryStmt(a,b){var c=NCH(b),d=(c-3)/3,e,f=null,g=null;REQ(b,SYM.try_stmt);e=astForSuite(a,CHILD(b,2));if(CHILD(b,c-3).type===TOK.T_NAME){if(CHILD(b,c-3).value==="finally"){if(c>=9&&CHILD(b,c-6).type===TOK.T_NAME){f=astForSuite(a,CHILD(b,c-4));d--}g=astForSuite(a,CHILD(b,c-1))}else f=astForSuite(a,CHILD(b,c-1));d--}else if(CHILD(b,c-3).type!==SYM.except_clause)throw new SyntaxError("malformed 'try' statement");if(d>0){c=[];for(var h=0;h<d;++h)c[h]=astForExceptClause(a,CHILD(b,3+h*3),CHILD(b,
5+h*3));e=[new TryExcept(e,c,f,b.lineno,b.col_offset)]}goog.asserts.assert(g!==null);return new TryFinally(e,g,b.lineno,b.col_offset)}function astForDottedName(a,b){REQ(b,SYM.dotted_name);for(var c=b.lineno,d=b.col_offset,e=strobj(CHILD(b,0).value),f=new Name(e,Load,c,d),g=2;g<NCH(b);g+=2){e=strobj(CHILD(b,g).value);f=new Attribute(f,e,Load,c,d)}return f}
function astForDecorator(a,b){REQ(b,SYM.decorator);REQ(CHILD(b,0),TOK.T_AT);REQ(CHILD(b,NCH(b)-1),TOK.T_NEWLINE);var c=astForDottedName(a,CHILD(b,1));return NCH(b)===3?c:NCH(b)===5?new Call(c,[],[],null,null,b.lineno,b.col_offset):astForCall(a,CHILD(b,3),c)}function astForDecorators(a,b){REQ(b,SYM.decorators);for(var c=[],d=0;d<NCH(b);++d)c[d]=astForDecorator(a,CHILD(b,d));return c}
function astForDecorated(a,b){REQ(b,SYM.decorated);var c=astForDecorators(a,CHILD(b,0));goog.asserts.assert(CHILD(b,1).type===SYM.funcdef||CHILD(b,1).type===SYM.classdef);var d=null;if(CHILD(b,1).type===SYM.funcdef)d=astForFuncdef(a,CHILD(b,1),c);else if(CHILD(b,1)===SYM.classdef)d=astForClassdef(a,CHILD(b,1),c);if(d){d.lineno=b.lineno;d.col_offset=b.col_offset}return d}function astForWithVar(a,b){REQ(b,SYM.with_var);return astForExpr(a,CHILD(b,1))}
function astForWithStmt(a,b){var c=3;goog.asserts.assert(b.type===SYM.with_stmt);var d=astForExpr(a,CHILD(b,1));if(CHILD(b,2).type===SYM.with_var){var e=astForWithVar(a,CHILD(b,2));setContext(a,e,Store,b);c=4}return new With_(d,e,astForSuite(a,CHILD(b,c)),b.lineno,b.col_offset)}
function astForExecStmt(a,b){var c,d=null,e=null,f=NCH(b);goog.asserts.assert(f===2||f===4||f===6);REQ(b,SYM.exec_stmt);c=astForExpr(a,CHILD(b,1));if(f>=4)d=astForExpr(a,CHILD(b,3));if(f===6)e=astForExpr(a,CHILD(b,5));return new Exec(c,d,e,b.lineno,b.col_offset)}
function astForIfStmt(a,b){REQ(b,SYM.if_stmt);if(NCH(b)===4)return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),[],b.lineno,b.col_offset);var c=CHILD(b,4).value.charAt(2);if(c==="s")return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),astForSuite(a,CHILD(b,6)),b.lineno,b.col_offset);else if(c==="i"){c=NCH(b)-4;var d=false,e=[];if(CHILD(b,c+1).type===TOK.T_NAME&&CHILD(b,c+1).value.charAt(2)==="s"){d=true;c-=3}c/=4;if(d){e=[new If_(astForExpr(a,CHILD(b,NCH(b)-6)),astForSuite(a,
CHILD(b,NCH(b)-4)),astForSuite(a,CHILD(b,NCH(b)-1)),CHILD(b,NCH(b)-6).lineno,CHILD(b,NCH(b)-6).col_offset)];c--}for(d=0;d<c;++d){var f=5+(c-d-1)*4;e=[new If_(astForExpr(a,CHILD(b,f)),astForSuite(a,CHILD(b,f+2)),e,CHILD(b,f).lineno,CHILD(b,f).col_offset)]}return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),e,b.lineno,b.col_offset)}goog.asserts.fail("unexpected token in 'if' statement")}
function astForExprlist(a,b,c){REQ(b,SYM.exprlist);for(var d=[],e=0;e<NCH(b);e+=2){var f=astForExpr(a,CHILD(b,e));d[e/2]=f;c&&setContext(a,f,c,CHILD(b,e))}return d}function astForDelStmt(a,b){REQ(b,SYM.del_stmt);return new Delete_(astForExprlist(a,CHILD(b,1),Del),b.lineno,b.col_offset)}function astForGlobalStmt(a,b){REQ(b,SYM.global_stmt);for(var c=[],d=1;d<NCH(b);d+=2)c[(d-1)/2]=strobj(CHILD(b,d).value);return new Global(c,b.lineno,b.col_offset)}
function astForAssertStmt(a,b){REQ(b,SYM.assert_stmt);if(NCH(b)===2)return new Assert(astForExpr(a,CHILD(b,1)),null,b.lineno,b.col_offset);else if(NCH(b)===4)return new Assert(astForExpr(a,CHILD(b,1)),astForExpr(a,CHILD(b,3)),b.lineno,b.col_offset);goog.asserts.fail("improper number of parts to assert stmt")}
function aliasForImportName(a,b){a:for(;;)switch(b.type){case SYM.import_as_name:var c=null;if(NCH(b)===3)c=CHILD(b,2).value;var d=strobj(CHILD(b,0).value);return new alias(d,strobj(c));case SYM.dotted_as_name:if(NCH(b)===1){b=CHILD(b,0);continue a}else{c=aliasForImportName(a,CHILD(b,0));goog.asserts.assert(!c.asname);c.asname=strobj(CHILD(b,2).value);return c}case SYM.dotted_name:if(NCH(b)===1)return new alias(strobj(CHILD(b,0).value),null);else{c="";for(d=0;d<NCH(b);d+=2)c+=CHILD(b,d).value+".";
return new alias(strobj(c.substr(0,c.length-1)),null)}case TOK.T_STAR:return new alias(strobj("*"),null);default:throw new SyntaxError("unexpected import name");}}
function astForImportStmt(a,b){REQ(b,SYM.import_stmt);var c=b.lineno,d=b.col_offset;b=CHILD(b,0);if(b.type===SYM.import_name){b=CHILD(b,1);REQ(b,SYM.dotted_as_names);for(var e=[],f=0;f<NCH(b);f+=2)e[f/2]=aliasForImportName(a,CHILD(b,f));return new Import_(e,c,d)}else if(b.type===SYM.import_from){var g=null,h=0;for(e=1;e<NCH(b);++e){if(CHILD(b,e).type===SYM.dotted_name){g=aliasForImportName(a,CHILD(b,e));e++;break}else if(CHILD(b,e).type!==TOK.T_DOT)break;h++}++e;switch(CHILD(b,e).type){case TOK.T_STAR:b=
CHILD(b,e);break;case TOK.T_LPAR:b=CHILD(b,e+1);NCH(b);break;case SYM.import_as_names:b=CHILD(b,e);e=NCH(b);if(e%2===0)throw new SyntaxError("trailing comma not allowed without surrounding parentheses");break;default:throw new SyntaxError("Unexpected node-type in from-import");}e=[];if(b.type===TOK.T_STAR)e[0]=aliasForImportName(a,b);else for(f=0;f<NCH(b);f+=2)e[f/2]=aliasForImportName(a,CHILD(b,f));return new ImportFrom(strobj(g?g.name.v:""),e,h,c,d)}throw new SyntaxError("unknown import statement");
}function astForTestlistGexp(a,b){goog.asserts.assert(b.type===SYM.testlist_gexp||b.type===SYM.argument);if(NCH(b)>1&&CHILD(b,1).type===SYM.gen_for)return astForGenexp(a,b);return astForTestlist(a,b)}
function astForListcomp(a,b){function c(n,p){for(var r=0;;){REQ(p,SYM.list_iter);if(CHILD(p,0).type===SYM.list_for)return r;p=CHILD(p,0);REQ(p,SYM.list_if);r++;if(NCH(p)==2)return r;p=CHILD(p,2)}}REQ(b,SYM.listmaker);goog.asserts.assert(NCH(b)>1);for(var d=astForExpr(a,CHILD(b,0)),e=function(n,p){var r=0,q=CHILD(p,1);a:for(;;){r++;REQ(q,SYM.list_for);if(NCH(q)===5)q=CHILD(q,4);else return r;b:for(;;){REQ(q,SYM.list_iter);q=CHILD(q,0);if(q.type===SYM.list_for)continue a;else if(q.type===SYM.list_if)if(NCH(q)===
3){q=CHILD(q,2);continue b}else return r;break}break}}(a,b),f=[],g=CHILD(b,1),h=0;h<e;++h){REQ(g,SYM.list_for);var i=CHILD(g,1),j=astForExprlist(a,i,Store),k=astForTestlist(a,CHILD(g,3));i=NCH(i)===1?new comprehension(j[0],k,[]):new comprehension(new Tuple(j,Store,g.lineno,g.col_offset),k,[]);if(NCH(g)===5){g=CHILD(g,4);j=c(a,g);k=[];for(var l=0;l<j;++l){REQ(g,SYM.list_iter);g=CHILD(g,0);REQ(g,SYM.list_if);k[l]=astForExpr(a,CHILD(g,1));if(NCH(g)===3)g=CHILD(g,2)}if(g.type===SYM.list_iter)g=CHILD(g,
0);i.ifs=k}f[h]=i}return new ListComp(d,f,b.lineno,b.col_offset)}
function astForFactor(a,b){if(CHILD(b,0).type===TOK.T_MINUS&&NCH(b)===2){var c=CHILD(b,1);if(c.type===SYM.factor&&NCH(c)===1){c=CHILD(c,0);if(c.type===SYM.power&&NCH(c)===1){c=CHILD(c,0);if(c.type===SYM.atom){var d=CHILD(c,0);if(d.type===TOK.T_NUMBER){d.value="-"+d.value;return astForAtom(a,c)}}}}}c=astForExpr(a,CHILD(b,1));switch(CHILD(b,0).type){case TOK.T_PLUS:return new UnaryOp(UAdd,c,b.lineno,b.col_offset);case TOK.T_MINUS:return new UnaryOp(USub,c,b.lineno,b.col_offset);case TOK.T_TILDE:return new UnaryOp(Invert,
c,b.lineno,b.col_offset)}goog.asserts.fail("unhandled factor")}function astForForStmt(a,b){var c=[];REQ(b,SYM.for_stmt);if(NCH(b)===9)c=astForSuite(a,CHILD(b,8));var d=CHILD(b,1),e=astForExprlist(a,d,Store);d=NCH(d)===1?e[0]:new Tuple(e,Store,b.lineno,b.col_offset);return new For_(d,astForTestlist(a,CHILD(b,3)),astForSuite(a,CHILD(b,5)),c,b.lineno,b.col_offset)}
function astForCall(a,b,c){REQ(b,SYM.arglist);for(var d=0,e=0,f=0,g=0;g<NCH(b);++g){var h=CHILD(b,g);if(h.type===SYM.argument)if(NCH(h)===1)d++;else if(CHILD(h,1).type===SYM.gen_for)f++;else e++}if(f>1||f&&(d||e))throw new SyntaxError("Generator expression must be parenthesized if not sole argument");if(d+e+f>255)throw new SyntaxError("more than 255 arguments");f=[];var i=[];e=d=0;var j=null,k=null;for(g=0;g<NCH(b);++g){h=CHILD(b,g);if(h.type===SYM.argument)if(NCH(h)===1){if(e)throw new SyntaxError("non-keyword arg after keyword arg");
if(j)throw new SyntaxError("only named arguments may follow *expression");f[d++]=astForExpr(a,CHILD(h,0))}else if(CHILD(h,1).type===SYM.gen_for)f[d++]=astForGenexp(a,h);else{var l=astForExpr(a,CHILD(h,0));if(l.constructor===Lambda)throw new SyntaxError("lambda cannot contain assignment");else if(l.constructor!==Name)throw new SyntaxError("keyword can't be an expression");l=l.id;forbiddenCheck(a,CHILD(h,0),l);for(var n=0;n<e;++n)if(i[n].arg===l)throw new SyntaxError("keyword argument repeated");i[e++]=
new keyword(l,astForExpr(a,CHILD(h,2)))}else if(h.type===TOK.T_STAR)j=astForExpr(a,CHILD(b,++g));else if(h.type===TOK.T_DOUBLESTAR)k=astForExpr(a,CHILD(b,++g))}return new Call(c,f,i,j,k,c.lineno,c.col_offset)}
function astForTrailer(a,b,c){REQ(b,SYM.trailer);if(CHILD(b,0).type===TOK.T_LPAR)return NCH(b)===2?new Call(c,[],[],null,null,b.lineno,b.col_offset):astForCall(a,CHILD(b,1),c);else if(CHILD(b,0).type===TOK.T_DOT)return new Attribute(c,strobj(CHILD(b,1).value),Load,b.lineno,b.col_offset);else{REQ(CHILD(b,0),TOK.T_LSQB);REQ(CHILD(b,2),TOK.T_RSQB);b=CHILD(b,1);if(NCH(b)===1)return new Subscript(c,astForSlice(a,CHILD(b,0)),Load,b.lineno,b.col_offset);else{for(var d=true,e=[],f=0;f<NCH(b);f+=2){var g=
astForSlice(a,CHILD(b,f));if(g.constructor!==Index)d=false;e[f/2]=g}if(!d)return new Subscript(c,new ExtSlice(e),Load,b.lineno,b.col_offset);a=[];for(f=0;f<e.length;++f){g=e[f];goog.asserts.assert(g.constructor===Index&&g.value!==null&&g.vaule!==undefined);a[f]=g.value}e=new Tuple(a,Load,b.lineno,b.col_offset);return new Subscript(c,new Index(e),Load,b.lineno,b.col_offset)}}}
function astForFlowStmt(a,b){var c;REQ(b,SYM.flow_stmt);c=CHILD(b,0);switch(c.type){case SYM.break_stmt:return new Break_(b.lineno,b.col_offset);case SYM.continue_stmt:return new Continue_(b.lineno,b.col_offset);case SYM.yield_stmt:return new Expr(astForExpr(a,CHILD(c,0)),b.lineno,b.col_offset);case SYM.return_stmt:return NCH(c)===1?new Return_(null,b.lineno,b.col_offset):new Return_(astForTestlist(a,CHILD(c,1)),b.lineno,b.col_offset);case SYM.raise_stmt:if(NCH(c)===1)return new Raise(null,null,null,
b.lineno,b.col_offset);else if(NCH(c)===2)return new Raise(astForExpr(a,CHILD(c,1)),null,null,b.lineno,b.col_offset);else if(NCH(c)===4)return new Raise(astForExpr(a,CHILD(c,1)),astForExpr(a,CHILD(c,3)),null,b.lineno,b.col_offset);else if(NCH(c)===6)return new Raise(astForExpr(a,CHILD(c,1)),astForExpr(a,CHILD(c,3)),astForExpr(a,CHILD(c,5)),b.lineno,b.col_offset);default:goog.asserts.fail("unexpected flow_stmt")}goog.asserts.fail("unhandled flow statement")}
function astForArguments(a,b){var c,d=null,e=null;if(b.type===SYM.parameters){if(NCH(b)===2)return new arguments_([],null,null,[]);b=CHILD(b,1)}REQ(b,SYM.varargslist);for(var f=[],g=[],h=false,i=0,j=0,k=0;i<NCH(b);){c=CHILD(b,i);switch(c.type){case SYM.fpdef:var l=0;a:for(;;){if(i+1<NCH(b)&&CHILD(b,i+1).type===TOK.T_EQUAL){g[j++]=astForExpr(a,CHILD(b,i+2));i+=2;h=true}else if(h){if(l)throw new SyntaxError("parenthesized arg with default");throw new SyntaxError("non-default argument follows default argument");
}if(NCH(c)===3){c=CHILD(c,1);if(NCH(c)!==1)throw new SyntaxError("tuple parameter unpacking has been removed");else{l=true;c=CHILD(c,0);goog.asserts.assert(c.type===SYM.fpdef);continue a}}if(CHILD(c,0).type===TOK.T_NAME){forbiddenCheck(a,b,CHILD(c,0).value);var n=strobj(CHILD(c,0).value);f[k++]=new Name(n,Param,c.lineno,c.col_offset)}i+=2;if(l)throw new SyntaxError("parenthesized argument names are invalid");break}break;case TOK.T_STAR:forbiddenCheck(a,CHILD(b,i+1),CHILD(b,i+1).value);d=CHILD(b,i+
1).value;i+=3;break;case TOK.T_DOUBLESTAR:forbiddenCheck(a,CHILD(b,i+1),CHILD(b,i+1).value);e=CHILD(b,i+1).value;i+=3;break;default:goog.asserts.fail("unexpected node in varargslist")}}return new arguments_(f,d,e,g)}function astForFuncdef(a,b,c){REQ(b,SYM.funcdef);var d=strobj(CHILD(b,1).value);forbiddenCheck(a,CHILD(b,1),CHILD(b,1).value);var e=astForArguments(a,CHILD(b,2));a=astForSuite(a,CHILD(b,4));return new FunctionDef(d,e,a,c,b.lineno,b.col_offset)}
function astForClassBases(a,b){goog.asserts.assert(NCH(b)>0);REQ(b,SYM.testlist);if(NCH(b)===1)return[astForExpr(a,CHILD(b,0))];return seqForTestlist(a,b)}
function astForClassdef(a,b,c){REQ(b,SYM.classdef);forbiddenCheck(a,b,CHILD(b,1).value);var d=strobj(CHILD(b,1).value);if(NCH(b)===4)return new ClassDef(d,[],astForSuite(a,CHILD(b,3)),c,b.lineno,b.col_offset);if(CHILD(b,3).type===TOK.T_RPAR)return new ClassDef(d,[],astForSuite(a,CHILD(b,5)),c,b.lineno,b.col_offset);var e=astForClassBases(a,CHILD(b,3));a=astForSuite(a,CHILD(b,6));return new ClassDef(d,e,a,c,b.lineno,b.col_offset)}
function astForLambdef(a,b){var c,d;if(NCH(b)===3){c=new arguments_([],null,null,[]);d=astForExpr(a,CHILD(b,2))}else{c=astForArguments(a,CHILD(b,1));d=astForExpr(a,CHILD(b,3))}return new Lambda(c,d,b.lineno,b.col_offset)}
function astForGenexp(a,b){function c(p,r){for(var q=0;;){REQ(r,SYM.gen_iter);if(CHILD(r,0).type===SYM.gen_for)return q;r=CHILD(r,0);REQ(r,SYM.gen_if);q++;if(NCH(r)==2)return q;r=CHILD(r,2)}}goog.asserts.assert(b.type===SYM.testlist_gexp||b.type===SYM.argument);goog.asserts.assert(NCH(b)>1);for(var d=astForExpr(a,CHILD(b,0)),e=function(p,r){var q=0,m=CHILD(r,1);a:for(;;){q++;REQ(m,SYM.gen_for);if(NCH(m)===5)m=CHILD(m,4);else return q;b:for(;;){REQ(m,SYM.gen_iter);m=CHILD(m,0);if(m.type===SYM.gen_for)continue a;
else if(m.type===SYM.gen_if)if(NCH(m)===3){m=CHILD(m,2);continue b}else return q;break}break}goog.asserts.fail("logic error in countGenFors")}(a,b),f=[],g=CHILD(b,1),h=0;h<e;++h){REQ(g,SYM.gen_for);var i=CHILD(g,1),j=astForExprlist(a,i,Store),k=astForExpr(a,CHILD(g,3));i=NCH(i)===1?new comprehension(j[0],k,[]):new comprehension(new Tuple(j,Store,g.lineno,g.col_offset),k,[]);if(NCH(g)===5){g=CHILD(g,4);j=c(a,g);for(var l=[],n=0;n<j;++n){REQ(g,SYM.gen_iter);g=CHILD(g,0);REQ(g,SYM.gen_if);k=astForExpr(a,
CHILD(g,1));l[n]=k;if(NCH(g)===3)g=CHILD(g,2)}if(g.type===SYM.gen_iter)g=CHILD(g,0);i.ifs=l}f[h]=i}return new GeneratorExp(d,f,b.lineno,b.col_offset)}
function astForWhileStmt(a,b){REQ(b,SYM.while_stmt);if(NCH(b)===4)return new While_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),[],b.lineno,b.col_offset);else if(NCH(b)===7)return new While_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),astForSuite(a,CHILD(b,6)),b.lineno,b.col_offset);goog.asserts.fail("wrong number of tokens for 'while' stmt")}
function astForAugassign(a,b){REQ(b,SYM.augassign);b=CHILD(b,0);switch(b.value.charAt(0)){case "+":return Add;case "-":return Sub;case "/":if(b.value.charAt(1)==="/")return FloorDiv;return Div;case "%":return Mod;case "<":return LShift;case ">":return RShift;case "&":return BitAnd;case "^":return BitXor;case "|":return BitOr;case "*":if(b.value.charAt(1)==="*")return Pow;return Mult;default:goog.asserts.fail("invalid augassign")}}
function astForBinop(a,b){for(var c=new BinOp(astForExpr(a,CHILD(b,0)),getOperator(CHILD(b,1)),astForExpr(a,CHILD(b,2)),b.lineno,b.col_offset),d=(NCH(b)-1)/2,e=1;e<d;++e){var f=CHILD(b,e*2+1),g=getOperator(f),h=astForExpr(a,CHILD(b,e*2+2));c=new BinOp(c,g,h,f.lineno,f.col_offset)}return c}
function astForTestlist(a,b){goog.asserts.assert(NCH(b)>0);if(b.type===SYM.testlist_gexp)NCH(b)>1&&goog.asserts.assert(CHILD(b,1).type!==SYM.gen_for);else goog.asserts.assert(b.type===SYM.testlist||b.type===SYM.testlist_safe||b.type===SYM.testlist1);return NCH(b)===1?astForExpr(a,CHILD(b,0)):new Tuple(seqForTestlist(a,b),Load,b.lineno,b.col_offset)}
function astForExprStmt(a,b){REQ(b,SYM.expr_stmt);if(NCH(b)===1)return new Expr(astForTestlist(a,CHILD(b,0)),b.lineno,b.col_offset);else if(CHILD(b,1).type===SYM.augassign){var c=CHILD(b,0),d=astForTestlist(a,c);switch(d.constructor){case GeneratorExp:throw new SyntaxError("augmented assignment to generator expression not possible");case Yield:throw new SyntaxError("augmented assignment to yield expression not possible");case Name:forbiddenCheck(a,c,d.id);break;case Attribute:case Subscript:break;
default:throw new SyntaxError("illegal expression for augmented assignment");}setContext(a,d,Store,c);c=CHILD(b,2);c=c.type===SYM.testlist?astForTestlist(a,c):astForExpr(a,c);return new AugAssign(d,astForAugassign(a,CHILD(b,1)),c,b.lineno,b.col_offset)}else{REQ(CHILD(b,1),TOK.T_EQUAL);d=[];for(var e=0;e<NCH(b)-2;e+=2){c=CHILD(b,e);if(c.type===SYM.yield_expr)throw new SyntaxError("assignment to yield expression not possible");c=astForTestlist(a,c);setContext(a,c,Store,CHILD(b,e));d[e/2]=c}c=CHILD(b,
NCH(b)-1);c=c.type===SYM.testlist?astForTestlist(a,c):astForExpr(a,c);return new Assign(d,c,b.lineno,b.col_offset)}}function astForIfexpr(a,b){goog.asserts.assert(NCH(b)===5);return new IfExp(astForExpr(a,CHILD(b,0)),astForExpr(a,CHILD(b,2)),astForExpr(a,CHILD(b,4)),b.lineno,b.col_offset)}
function parsestr(a,b){var c=b.charAt(0),d=false;if(c==="u"||c==="U"){b=b.substr(1);c=b.charAt(0)}else if(c==="r"||c==="R"){b=b.substr(1);c=b.charAt(0);d=true}goog.asserts.assert(c!=="b"&&c!=="B","todo; haven't done b'' strings yet");goog.asserts.assert(c==="'"||c==='"'&&b.charAt(b.length-1)===c);b=b.substr(1,b.length-2);if(b.length>=4&&b.charAt(0)===c&&b.charAt(1)===c){goog.asserts.assert(b.charAt(b.length-1)===c&&b.charAt(b.length-2)===c);b=b.substr(2,b.length-4)}if(d||b.indexOf("\\")===-1)return strobj(decodeURIComponent(escape(b)));
return strobj(function(e){for(var f=e.length,g="",h=0;h<f;++h){var i=e[h];if(i==="\\"){++h;i=e[h];if(i==="n")g+="\n";else if(i==="\\")g+="\\";else if(i==="t")g+="\t";else if(i==="r")g+="\r";else if(i==="0")g+="\u0000";else if(i==="x"){i=e[++h];var j=e[++h];g+=String.fromCharCode(parseInt(i+j,16))}else if(i==="u"||i==="U"){i=e[++h];j=e[++h];var k=e[++h],l=e[++h];g+=String.fromCharCode(parseInt(i+j,16),parseInt(k+l,16))}else goog.asserts.fail("unhandled escape")}else g+=i}return g}(b))}
function parsestrplus(a,b){REQ(CHILD(b,0),TOK.T_STRING);for(var c=new Sk.builtin.str(""),d=0;d<NCH(b);++d)c=c.sq$concat(parsestr(a,CHILD(b,d).value));return c}
function parsenumber(a,b){var c=b.charAt(b.length-1);if(c==="l"||c==="L")return Sk.longFromStr(b.substr(0,b.length-1));c=goog.global.eval(b);if((c>Sk.builtin.lng.threshold$||c<-Sk.builtin.lng.threshold$)&&Math.floor(c)===c)return Sk.longFromStr(b);if(b.indexOf(".")!==-1||b.indexOf("e")!==-1||b.indexOf("E")!==-1)return parseFloat(b);c=b;if(b.charAt(0)==="-")c=b.substr(1);return c.charAt(0)==="0"&&(c.charAt(1)==="x"||c.charAt(1)==="X")?parseInt(b,16):c.charAt(0)==="0"&&(c.charAt(1)==="b"||c.charAt(1)===
"B")?parseInt(b,2):c.charAt(0)==="0"?parseInt(b,8):parseInt(b,10)}
function astForSlice(a,b){REQ(b,SYM.subscript);var c=CHILD(b,0),d=null,e=null,f=null;if(c.type===TOK.T_DOT)return new Ellipsis;if(NCH(b)===1&&c.type===SYM.test)return new Index(astForExpr(a,c));if(c.type===SYM.test)d=astForExpr(a,c);if(c.type===TOK.T_COLON){if(NCH(b)>1){c=CHILD(b,1);if(c.type===SYM.test)e=astForExpr(a,c)}}else if(NCH(b)>2){c=CHILD(b,2);if(c.type===SYM.test)e=astForExpr(a,c)}c=CHILD(b,NCH(b)-1);if(c.type===SYM.sliceop)if(NCH(c)===1){c=CHILD(c,0);f=new Name(strobj("None"),Load,c.lineno,
c.col_offset)}else{c=CHILD(c,1);if(c.type===SYM.test)f=astForExpr(a,c)}return new Slice(d,e,f)}
function astForAtom(a,b){var c=CHILD(b,0);switch(c.type){case TOK.T_NAME:return new Name(strobj(c.value),Load,b.lineno,b.col_offset);case TOK.T_STRING:return new Str(parsestrplus(a,b),b.lineno,b.col_offset);case TOK.T_NUMBER:return new Num(parsenumber(a,c.value),b.lineno,b.col_offset);case TOK.T_LPAR:c=CHILD(b,1);if(c.type===TOK.T_RPAR)return new Tuple([],Load,b.lineno,b.col_offset);if(c.type===SYM.yield_expr)return astForExpr(a,c);if(NCH(c)>1&&CHILD(c,1).type===SYM.gen_for)return astForGenexp(a,
c);return astForTestlistGexp(a,c);case TOK.T_LSQB:c=CHILD(b,1);if(c.type===TOK.T_RSQB)return new List([],Load,b.lineno,b.col_offset);REQ(c,SYM.listmaker);return NCH(c)===1||CHILD(c,1).type===TOK.T_COMMA?new List(seqForTestlist(a,c),Load,b.lineno,b.col_offset):astForListcomp(a,c);case TOK.T_LBRACE:c=CHILD(b,1);NCH(c);for(var d=[],e=[],f=0;f<NCH(c);f+=4){d[f/4]=astForExpr(a,CHILD(c,f));e[f/4]=astForExpr(a,CHILD(c,f+2))}return new Dict(d,e,b.lineno,b.col_offset);case TOK.T_BACKQUOTE:throw new SyntaxError("backquote not supported, use repr()");
default:goog.asserts.fail("unhandled atom",c.type)}}function astForPower(a,b){REQ(b,SYM.power);var c=astForAtom(a,CHILD(b,0));if(NCH(b)===1)return c;for(var d=1;d<NCH(b);++d){var e=CHILD(b,d);if(e.type!==SYM.trailer)break;e=astForTrailer(a,e,c);e.lineno=c.lineno;e.col_offset=c.col_offset;c=e}if(CHILD(b,NCH(b)-1).type===SYM.factor){d=astForExpr(a,CHILD(b,NCH(b)-1));c=new BinOp(c,Pow,d,b.lineno,b.col_offset)}return c}
function astForExpr(a,b){a:for(;;){switch(b.type){case SYM.test:case SYM.old_test:if(CHILD(b,0).type===SYM.lambdef||CHILD(b,0).type===SYM.old_lambdef)return astForLambdef(a,CHILD(b,0));else if(NCH(b)>1)return astForIfexpr(a,b);case SYM.or_test:case SYM.and_test:if(NCH(b)===1){b=CHILD(b,0);continue a}for(var c=[],d=0;d<NCH(b);d+=2)c[d/2]=astForExpr(a,CHILD(b,d));if(CHILD(b,1).value==="and")return new BoolOp(And,c,b.lineno,b.col_offset);goog.asserts.assert(CHILD(b,1).value==="or");return new BoolOp(Or,
c,b.lineno,b.col_offset);case SYM.not_test:if(NCH(b)===1){b=CHILD(b,0);continue a}else return new UnaryOp(Not,astForExpr(a,CHILD(b,1)),b.lineno,b.col_offset);case SYM.comparison:if(NCH(b)===1){b=CHILD(b,0);continue a}else{c=[];var e=[];for(d=1;d<NCH(b);d+=2){c[(d-1)/2]=astForCompOp(a,CHILD(b,d));e[(d-1)/2]=astForExpr(a,CHILD(b,d+1))}return new Compare(astForExpr(a,CHILD(b,0)),c,e,b.lineno,b.col_offset)}case SYM.expr:case SYM.xor_expr:case SYM.and_expr:case SYM.shift_expr:case SYM.arith_expr:case SYM.term:if(NCH(b)===
1){b=CHILD(b,0);continue a}return astForBinop(a,b);case SYM.yield_expr:d=null;if(NCH(b)===2)d=astForTestlist(a,CHILD(b,1));return new Yield(d,b.lineno,b.col_offset);case SYM.factor:if(NCH(b)===1){b=CHILD(b,0);continue a}return astForFactor(a,b);case SYM.power:return astForPower(a,b);default:goog.asserts.fail("unhandled expr","n.type: %d",b.type)}break}}
function astForPrintStmt(a,b){var c=1,d=null;REQ(b,SYM.print_stmt);if(NCH(b)>=2&&CHILD(b,1).type===TOK.T_RIGHTSHIFT){d=astForExpr(a,CHILD(b,2));c=4}var e=[];c=c;for(var f=0;c<NCH(b);c+=2,++f)e[f]=astForExpr(a,CHILD(b,c));c=CHILD(b,NCH(b)-1).type===TOK.T_COMMA?false:true;return new Print(d,e,c,b.lineno,b.col_offset)}
function astForStmt(a,b){if(b.type===SYM.stmt){goog.asserts.assert(NCH(b)===1);b=CHILD(b,0)}if(b.type===SYM.simple_stmt){goog.asserts.assert(numStmts(b)===1);b=CHILD(b,0)}if(b.type===SYM.small_stmt){REQ(b,SYM.small_stmt);b=CHILD(b,0);switch(b.type){case SYM.expr_stmt:return astForExprStmt(a,b);case SYM.print_stmt:return astForPrintStmt(a,b);case SYM.del_stmt:return astForDelStmt(a,b);case SYM.pass_stmt:return new Pass(b.lineno,b.col_offset);case SYM.flow_stmt:return astForFlowStmt(a,b);case SYM.import_stmt:return astForImportStmt(a,
b);case SYM.global_stmt:return astForGlobalStmt(a,b);case SYM.exec_stmt:return astForExecStmt(a,b);case SYM.assert_stmt:return astForAssertStmt(a,b);default:goog.asserts.fail("unhandled small_stmt")}}else{var c=CHILD(b,0);REQ(b,SYM.compound_stmt);switch(c.type){case SYM.if_stmt:return astForIfStmt(a,c);case SYM.while_stmt:return astForWhileStmt(a,c);case SYM.for_stmt:return astForForStmt(a,c);case SYM.try_stmt:return astForTryStmt(a,c);case SYM.with_stmt:return astForWithStmt(a,c);case SYM.funcdef:return astForFuncdef(a,
c,[]);case SYM.classdef:return astForClassdef(a,c,[]);case SYM.decorated:return astForDecorated(a,c);default:goog.asserts.assert("unhandled compound_stmt")}}}
Sk.astFromParse=function(a,b){var c=new Compiling("utf-8",b),d=[],e,f=0;switch(a.type){case SYM.file_input:for(var g=0;g<NCH(a)-1;++g){e=CHILD(a,g);if(a.type!==TOK.T_NEWLINE){REQ(e,SYM.stmt);var h=numStmts(e);if(h===1)d[f++]=astForStmt(c,e);else{e=CHILD(e,0);REQ(e,SYM.simple_stmt);for(var i=0;i<h;++i)d[f++]=astForStmt(c,CHILD(e,i*2))}}}return new Module(d);case SYM.eval_input:goog.asserts.fail("todo;");case SYM.single_input:goog.asserts.fail("todo;");default:goog.asserts.fail("todo;")}};
Sk.astDump=function(a){var b=function(d){for(var e="",f=0;f<d;++f)e+=" ";return e},c=function(d,e){if(d===null)return e+"None";else if(d.prototype&&d.prototype._astname!==undefined&&d.prototype._isenum)return e+d.prototype._astname+"()";else if(d._astname!==undefined){for(var f=b(d._astname.length+1),g=[],h=0;h<d._fields.length;h+=2){var i=d._fields[h],j=d._fields[h+1](d),k=b(i.length+1);g.push([i,c(j,e+f+k)])}i=[];for(h=0;h<g.length;++h){j=g[h];i.push(j[0]+"="+j[1].replace(/^\s+/,""))}h=i.join(",\n"+
e+f);return e+d._astname+"("+h+")"}else if(goog.isArrayLike(d)){f=[];for(h=0;h<d.length;++h)f.push(c(d[h],e+" "));h=f.join(",\n");return e+"["+h.replace(/^\s+/,"")+"]"}else{h=d===true?"True":d===false?"False":d instanceof Sk.builtin.lng?d.tp$str().v:d instanceof Sk.builtin.str?d.$r().v:""+d;return e+h}};return c(a,"")};goog.exportSymbol("Sk.astFromParse",Sk.astFromParse);goog.exportSymbol("Sk.astDump",Sk.astDump);var DEF_GLOBAL=1,DEF_LOCAL=2,DEF_PARAM=4,USE=8,DEF_STAR=16,DEF_DOUBLESTAR=32,DEF_INTUPLE=64,DEF_FREE=128,DEF_FREE_GLOBAL=256,DEF_FREE_CLASS=512,DEF_IMPORT=1024,DEF_BOUND=DEF_LOCAL|DEF_PARAM|DEF_IMPORT,SCOPE_OFF=11,SCOPE_MASK=7,LOCAL=1,GLOBAL_EXPLICIT=2,GLOBAL_IMPLICIT=3,FREE=4,CELL=5,OPT_IMPORT_STAR=1,OPT_EXEC=2,OPT_BARE_EXEC=4,OPT_TOPLEVEL=8,GENERATOR=2,GENERATOR_EXPRESSION=2,ModuleBlock="module",FunctionBlock="function",ClassBlock="class";
function Symbol(a,b,c){this.__name=a;this.__flags=b;this.__scope=b>>SCOPE_OFF&SCOPE_MASK;this.__namespaces=c||[]}Symbol.prototype.get_name=function(){return this.__name};Symbol.prototype.is_referenced=function(){return!!(this.__flags&USE)};Symbol.prototype.is_parameter=function(){return!!(this.__flags&DEF_PARAM)};Symbol.prototype.is_global=function(){return this.__scope===GLOBAL_IMPLICIT||this.__scope==GLOBAL_EXPLICIT};Symbol.prototype.is_declared_global=function(){return this.__scope==GLOBAL_EXPLICIT};
Symbol.prototype.is_local=function(){return!!(this.__flags&DEF_BOUND)};Symbol.prototype.is_free=function(){return this.__scope==FREE};Symbol.prototype.is_imported=function(){return!!(this.__flags&DEF_IMPORT)};Symbol.prototype.is_assigned=function(){return!!(this.__flags&DEF_LOCAL)};Symbol.prototype.is_namespace=function(){return this.__namespaces&&this.__namespaces.length>0};Symbol.prototype.get_namespaces=function(){return this.__namespaces};var astScopeCounter=0;
function SymbolTableScope(a,b,c,d,e){this.symFlags={};this.name=b;this.varnames=[];this.children=[];this.blockType=c;this.returnsValue=this.varkeywords=this.varargs=this.generator=this.childHasFree=this.hasFree=this.isNested=false;this.lineno=e;this.table=a;if(a.cur&&(a.cur.nested||a.cur.blockType===FunctionBlock))this.isNested=true;d.scopeId=astScopeCounter++;a.stss[d.scopeId]=this;this.symbols={}}SymbolTableScope.prototype.get_type=function(){return this.blockType};
SymbolTableScope.prototype.get_name=function(){return this.name};SymbolTableScope.prototype.get_lineno=function(){return this.lineno};SymbolTableScope.prototype.is_nested=function(){return this.isNested};SymbolTableScope.prototype.has_children=function(){return this.children.length>0};SymbolTableScope.prototype.get_identifiers=function(){return this._identsMatching(function(){return true})};
SymbolTableScope.prototype.lookup=function(a){if(this.symbols.hasOwnProperty(a))a=this.symbols[a];else{var b=this.symFlags[a],c=this.__check_children(a);a=this.symbols[a]=new Symbol(a,b,c)}return a};SymbolTableScope.prototype.__check_children=function(a){for(var b=[],c=0;c<this.children.length;++c){var d=this.children[c];d.name===a&&b.push(d)}return b};
SymbolTableScope.prototype._identsMatching=function(a){var b=[],c;for(c in this.symFlags)this.symFlags.hasOwnProperty(c)&&a(this.symFlags[c])&&b.push(c);b.sort();return b};SymbolTableScope.prototype.get_parameters=function(){goog.asserts.assert(this.get_type()=="function","get_parameters only valid for function scopes");if(!this._funcParams)this._funcParams=this._identsMatching(function(a){return a&DEF_PARAM});return this._funcParams};
SymbolTableScope.prototype.get_locals=function(){goog.asserts.assert(this.get_type()=="function","get_locals only valid for function scopes");if(!this._funcLocals)this._funcLocals=this._identsMatching(function(a){return a&DEF_BOUND});return this._funcLocals};
SymbolTableScope.prototype.get_globals=function(){goog.asserts.assert(this.get_type()=="function","get_globals only valid for function scopes");if(!this._funcGlobals)this._funcGlobals=this._identsMatching(function(a){a=a>>SCOPE_OFF&SCOPE_MASK;return a==GLOBAL_IMPLICIT||a==GLOBAL_EXPLICIT});return this._funcGlobals};
SymbolTableScope.prototype.get_frees=function(){goog.asserts.assert(this.get_type()=="function","get_frees only valid for function scopes");if(!this._funcFrees)this._funcFrees=this._identsMatching(function(a){return(a>>SCOPE_OFF&SCOPE_MASK)==FREE});return this._funcFrees};
SymbolTableScope.prototype.get_methods=function(){goog.asserts.assert(this.get_type()=="class","get_methods only valid for class scopes");if(!this._classMethods){for(var a=[],b=0;b<this.children.length;++b)a.push(this.children[b].name);a.sort();this._classMethods=a}return this._classMethods};SymbolTableScope.prototype.getScope=function(a){a=this.symFlags[a];if(a===undefined)return 0;return a>>SCOPE_OFF&SCOPE_MASK};
function SymbolTable(a){this.filename=a;this.top=this.cur=null;this.stack=[];this.curClass=this.global=null;this.tmpname=0;this.stss={}}SymbolTable.prototype.getStsForAst=function(a){goog.asserts.assert(a.scopeId!==undefined,"ast wasn't added to st?");a=this.stss[a.scopeId];goog.asserts.assert(a!==undefined,"unknown sym tab entry");return a};
SymbolTable.prototype.SEQStmt=function(a){goog.asserts.assert(goog.isArrayLike(a),"SEQ: nodes isn't array? got %s",a);for(var b=a.length,c=0;c<b;++c){var d=a[c];d&&this.visitStmt(d)}};SymbolTable.prototype.SEQExpr=function(a){goog.asserts.assert(goog.isArrayLike(a),"SEQ: nodes isn't array? got %s",a);for(var b=a.length,c=0;c<b;++c){var d=a[c];d&&this.visitExpr(d)}};
SymbolTable.prototype.enterBlock=function(a,b,c,d){var e=null;if(this.cur){e=this.cur;this.stack.push(this.cur)}this.cur=new SymbolTableScope(this,a,b,c,d);if(a==="top")this.global=this.cur.symFlags;e&&e.children.push(this.cur)};SymbolTable.prototype.exitBlock=function(){this.cur=null;if(this.stack.length>0)this.cur=this.stack.pop()};
SymbolTable.prototype.visitParams=function(a,b){for(var c=0;c<a.length;++c){var d=a[c];if(d.constructor===Name){goog.asserts.assert(d.ctx===Param||d.ctx===Store&&!b);this.addDef(d.id,DEF_PARAM)}else throw new SyntaxError("invalid expression in parameter list");}};SymbolTable.prototype.visitArguments=function(a){a.args&&this.visitParams(a.args,true);if(a.vararg){this.addDef(a.vararg,DEF_PARAM);this.cur.varargs=true}if(a.kwarg){this.addDef(a.kwarg,DEF_PARAM);this.cur.varkeywords=true}};
SymbolTable.prototype.newTmpname=function(){this.addDef(new Sk.builtin.str("_["+ ++this.tmpname+"]"),DEF_LOCAL)};
SymbolTable.prototype.addDef=function(a,b){var c=mangleName(this.curClass,a).v,d=this.cur.symFlags[c];if(d!==undefined){if(b&DEF_PARAM&&d&DEF_PARAM)throw new Sk.builtin.SyntaxError("duplicate argument '"+a+"' in function definition");d|=b}else d=b;this.cur.symFlags[c]=d;if(b&DEF_PARAM)this.cur.varnames.push(c);else if(b&DEF_GLOBAL){d=b;var e=this.global[c];if(e!==undefined)d|=e;this.global[c]=d}};
SymbolTable.prototype.visitSlice=function(a){switch(a.constructor){case Slice:a.lower&&this.visitExpr(a.lower);a.upper&&this.visitExpr(a.upper);a.step&&this.visitExpr(a.step);break;case ExtSlice:for(var b=0;b<a.dims.length;++b)this.visitSlice(a.dims[b]);break;case Index:this.visitExpr(a.value)}};
SymbolTable.prototype.visitStmt=function(a){goog.asserts.assert(a!==undefined,"visitStmt called with undefined");switch(a.constructor){case FunctionDef:this.addDef(a.name,DEF_LOCAL);a.args.defaults&&this.SEQExpr(a.args.defaults);a.decorator_list&&this.SEQExpr(a.decorator_list);this.enterBlock(a.name.v,FunctionBlock,a,a.lineno);this.visitArguments(a.args);this.SEQStmt(a.body);this.exitBlock();break;case ClassDef:this.addDef(a.name,DEF_LOCAL);this.SEQExpr(a.bases);a.decorator_list&&this.SEQExpr(a.decorator_list);
this.enterBlock(a.name.v,ClassBlock,a,a.lineno);var b=this.curClass;this.curClass=a.name;this.SEQStmt(a.body);this.curCalss=b;this.exitBlock();break;case Return_:if(a.value){this.visitExpr(a.value);this.cur.returnsValue=true;if(this.cur.generator)throw new SyntaxError("'return' with argument inside generator");}break;case Delete_:this.SEQExpr(a.targets);break;case Assign:this.SEQExpr(a.targets);this.visitExpr(a.value);break;case AugAssign:this.visitExpr(a.target);this.visitExpr(a.value);break;case Print:a.dest&&
this.visitExpr(a.dest);this.SEQExpr(a.values);break;case For_:this.visitExpr(a.target);this.visitExpr(a.iter);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case While_:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case If_:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case Raise:if(a.type){this.visitExpr(a.type);if(a.inst){this.visitExpr(a.inst);a.tback&&this.visitExpr(a.tback)}}break;case TryExcept:this.SEQStmt(a.body);
this.SEQStmt(a.orelse);this.visitExcepthandler(a.handlers);break;case TryFinally:this.SEQStmt(a.body);this.SEQStmt(a.finalbody);break;case Assert:this.visitExpr(a.test);a.msg&&this.visitExpr(a.msg);break;case Import_:case ImportFrom:this.visitAlias(a.names);break;case Exec:this.visitExpr(a.body);if(a.globals){this.visitExpr(a.globals);a.locals&&this.visitExpr(a.locals)}break;case Global:b=a.names.length;for(var c=0;c<b;++c){var d=mangleName(this.curClass,a.names[c]).v,e=this.cur.symFlags[d];if(e&
(DEF_LOCAL|USE))if(e&DEF_LOCAL)throw new SyntaxError("name '"+d+"' is assigned to before global declaration");else throw new SyntaxError("name '"+d+"' is used prior to global declaration");this.addDef(new Sk.builtin.str(d),DEF_GLOBAL)}break;case Expr:this.visitExpr(a.value);break;case Pass:case Break_:case Continue_:break;case With_:this.newTmpname();this.visitExpr(a.context_expr);if(a.optional_vars){this.newTmpname();this.visitExpr(a.optional_vars)}this.SEQStmt(a.body);break;default:goog.asserts.fail("Unhandled type "+
a.constructor.name+" in visitStmt")}};
SymbolTable.prototype.visitExpr=function(a){goog.asserts.assert(a!==undefined,"visitExpr called with undefined");switch(a.constructor){case BoolOp:this.SEQExpr(a.values);break;case BinOp:this.visitExpr(a.left);this.visitExpr(a.right);break;case UnaryOp:this.visitExpr(a.operand);break;case Lambda:this.addDef(new Sk.builtin.str("lambda"),DEF_LOCAL);a.args.defaults&&this.SEQExpr(a.args.defaults);this.enterBlock("lambda",FunctionBlock,a,a.lineno);this.visitArguments(a.args);this.visitExpr(a.body);this.exitBlock();
break;case IfExp:this.visitExpr(a.test);this.visitExpr(a.body);this.visitExpr(a.orelse);break;case Dict:this.SEQExpr(a.keys);this.SEQExpr(a.values);break;case ListComp:this.newTmpname();this.visitExpr(a.elt);this.visitComprehension(a.generators,0);break;case GeneratorExp:this.visitGenexp(a);break;case Yield:a.value&&this.visitExpr(a.value);this.cur.generator=true;if(this.cur.returnsValue)throw new SyntaxError("'return' with argument inside generator");break;case Compare:this.visitExpr(a.left);this.SEQExpr(a.comparators);
break;case Call:this.visitExpr(a.func);this.SEQExpr(a.args);for(var b=0;b<a.keywords.length;++b)this.visitExpr(a.keywords[b].value);this.starargs&&this.visitExpr(a.starargs);this.kwargs&&this.visitExpr(a.kwargs);break;case Num:case Str:break;case Attribute:this.visitExpr(a.value);break;case Subscript:this.visitExpr(a.value);this.visitSlice(a.slice);break;case Name:this.addDef(a.id,a.ctx===Load?USE:DEF_LOCAL);break;case List:case Tuple:this.SEQExpr(a.elts);break;default:goog.asserts.fail("Unhandled type "+
a.constructor.name+" in visitExpr")}};SymbolTable.prototype.visitComprehension=function(a,b){for(var c=a.length,d=b;d<c;++d){var e=a[d];this.visitExpr(e.target);this.visitExpr(e.iter);this.SEQExpr(e.ifs)}};
SymbolTable.prototype.visitAlias=function(a){for(var b=0;b<a.length;++b){var c=a[b];var d=c=c.asname===null?c.name.v:c.asname.v,e=c.indexOf(".");if(e!==-1)d=c.substr(0,e);if(c!=="*")this.addDef(new Sk.builtin.str(d),DEF_IMPORT);else if(this.cur.blockType!==ModuleBlock)throw new SyntaxError("import * only allowed at module level");}};
SymbolTable.prototype.visitGenexp=function(a){var b=a.generators[0];this.visitExpr(b.iter);this.enterBlock("genexpr",FunctionBlock,a,a.lineno);this.cur.generator=true;this.addDef(new Sk.builtin.str(".0"),DEF_PARAM);this.visitExpr(b.target);this.SEQExpr(b.ifs);this.visitComprehension(a.generators,1);this.visitExpr(a.elt);this.exitBlock()};SymbolTable.prototype.visitExcepthandler=function(){goog.asserts.fail("todo;")};function _dictUpdate(a,b){for(var c in b)a[c]=b[c]}
SymbolTable.prototype.analyzeBlock=function(a,b,c,d){var e={},f={},g={},h={},i={};if(a.blockType==ClassBlock){_dictUpdate(g,d);b&&_dictUpdate(h,b)}for(var j in a.symFlags)this.analyzeName(a,f,j,a.symFlags[j],b,e,c,d);if(a.blockType!==ClassBlock){a.blockType===FunctionBlock&&_dictUpdate(h,e);b&&_dictUpdate(h,b);_dictUpdate(g,d)}d={};e=a.children.length;for(j=0;j<e;++j){var k=a.children[j];this.analyzeChildBlock(k,h,i,g,d);if(k.hasFree||k.childHasFree)a.childHasFree=true}_dictUpdate(i,d);a.blockType===
FunctionBlock&&this.analyzeCells(f,i);this.updateSymbols(a.symFlags,f,b,i,a.blockType===ClassBlock);_dictUpdate(c,i)};SymbolTable.prototype.analyzeChildBlock=function(a,b,c,d,e){var f={};_dictUpdate(f,b);b={};_dictUpdate(b,c);c={};_dictUpdate(c,d);this.analyzeBlock(a,f,b,c);_dictUpdate(e,b)};SymbolTable.prototype.analyzeCells=function(a,b){for(var c in a)if(a[c]===LOCAL)if(b[c]!==undefined){a[c]=CELL;delete b[c]}};
SymbolTable.prototype.updateSymbols=function(a,b,c,d,e){for(var f in a){var g=a[f];g|=b[f]<<SCOPE_OFF;a[f]=g}b=FREE<<SCOPE_OFF;for(f in d){g=a[f];if(g!==undefined){if(e&&g&(DEF_BOUND|DEF_GLOBAL))a[f]=g|DEF_FREE_CLASS}else if(c[f]!==undefined)a[f]=b}};
SymbolTable.prototype.analyzeName=function(a,b,c,d,e,f,g,h){if(d&DEF_GLOBAL){if(d&DEF_PARAM)throw new Sk.builtin.SyntaxError("name '"+c+"' is local and global");b[c]=GLOBAL_EXPLICIT;h[c]=null;e&&e[c]!==undefined&&delete e[c]}else if(d&DEF_BOUND){b[c]=LOCAL;f[c]=null;delete h[c]}else if(e&&e[c]!==undefined){b[c]=FREE;a.hasFree=true;g[c]=null}else{if(!(h&&h[c]!==undefined))if(a.isNested)a.hasFree=true;b[c]=GLOBAL_IMPLICIT}};
SymbolTable.prototype.analyze=function(){this.analyzeBlock(this.top,null,{},{})};Sk.symboltable=function(a,b){var c=new SymbolTable(b);c.enterBlock("top",ModuleBlock,a,0);c.top=c.cur;for(var d=0;d<a.body.length;++d)c.visitStmt(a.body[d]);c.exitBlock();c.analyze();return c};
Sk.dumpSymtab=function(a){var b=function(e){return e?"True":"False"},c=function(e){for(var f=[],g=0;g<e.length;++g)f.push((new Sk.builtin.str(e[g])).$r().v);return"["+f.join(", ")+"]"},d=function(e,f){if(f===undefined)f="";var g="";g+=f+"Sym_type: "+e.get_type()+"\n";g+=f+"Sym_name: "+e.get_name()+"\n";g+=f+"Sym_lineno: "+e.get_lineno()+"\n";g+=f+"Sym_nested: "+b(e.is_nested())+"\n";g+=f+"Sym_haschildren: "+b(e.has_children())+"\n";if(e.get_type()==="class")g+=f+"Class_methods: "+c(e.get_methods())+
"\n";else if(e.get_type()==="function"){g+=f+"Func_params: "+c(e.get_parameters())+"\n";g+=f+"Func_locals: "+c(e.get_locals())+"\n";g+=f+"Func_globals: "+c(e.get_globals())+"\n";g+=f+"Func_frees: "+c(e.get_frees())+"\n"}g+=f+"-- Identifiers --\n";for(var h=e.get_identifiers(),i=h.length,j=0;j<i;++j){var k=e.lookup(h[j]);g+=f+"name: "+k.get_name()+"\n";g+=f+" is_referenced: "+b(k.is_referenced())+"\n";g+=f+" is_imported: "+b(k.is_imported())+"\n";g+=f+" is_parameter: "+b(k.is_parameter())+"\n";
g+=f+" is_global: "+b(k.is_global())+"\n";g+=f+" is_declared_global: "+b(k.is_declared_global())+"\n";g+=f+" is_local: "+b(k.is_local())+"\n";g+=f+" is_free: "+b(k.is_free())+"\n";g+=f+" is_assigned: "+b(k.is_assigned())+"\n";g+=f+" is_namespace: "+b(k.is_namespace())+"\n";k=k.get_namespaces();var l=k.length;g+=f+" namespaces: [\n";for(var n=[],p=0;p<l;++p)n.push(d(k[p],f+" "));g+=n.join("\n");g+=f+" ]\n"}return g};return d(a.top,"")};goog.exportSymbol("Sk.symboltable",Sk.symboltable);
goog.exportSymbol("Sk.dumpSymtab",Sk.dumpSymtab);var out;function Compiler(a,b,c,d){this.filename=a;this.st=b;this.flags=c;this.interactive=false;this.nestlevel=0;this.u=null;this.stack=[];this.result=[];this.gensymcount=0;this.allUnits=[];this.source=d?d.split("\n"):false}
function CompilerUnit(){this.private_=this.name=this.ste=null;this.lineno=this.firstlineno=0;this.linenoSet=false;this.localnames=[];this.blocknum=0;this.blocks=[];this.curblock=0;this.scopename=null;this.suffixCode=this.switchCode=this.varDeclsCode=this.prefixCode="";this.breakBlocks=[];this.continueBlocks=[]}CompilerUnit.prototype.activateScope=function(){var a=this;out=function(){for(var b=a.blocks[a.curblock],c=0;c<arguments.length;++c)b.push(arguments[c])}};
Compiler.prototype.getSourceLine=function(a){goog.asserts.assert(this.source);return this.source[a-1]};Compiler.prototype.annotateSource=function(a){if(this.source){var b=a.lineno;a=a.col_offset;out("\n//\n// line ",b,":\n// ",this.getSourceLine(b),"\n// ");for(b=0;b<a;++b)out(" ");out("^\n//\n")}};Compiler.prototype.gensym=function(a){a=a||"";a="$"+a;a+=this.gensymcount++;return a};Compiler.prototype.niceName=function(a){return this.gensym(a.replace("<","").replace(">","").replace(" ","_"))};
var reservedWords_={"abstract":true,as:true,"boolean":true,"break":true,"byte":true,"case":true,"catch":true,"char":true,"class":true,"continue":true,"const":true,"debugger":true,"default":true,"delete":true,"do":true,"double":true,"else":true,"enum":true,"export":true,"extends":true,"false":true,"final":true,"finally":true,"float":true,"for":true,"function":true,"goto":true,"if":true,"implements":true,"import":true,"in":true,"instanceof":true,"int":true,"interface":true,is:true,"long":true,namespace:true,
"native":true,"new":true,"null":true,"package":true,"private":true,"protected":true,"public":true,"return":true,"short":true,"static":true,"super":true,"switch":true,"synchronized":true,"this":true,"throw":true,"throws":true,"transient":true,"true":true,"try":true,"typeof":true,use:true,"var":true,"void":true,"volatile":true,"while":true,"with":true};function fixReservedWords(a){if(reservedWords_[a]!==true)return a;return a+"_$rw$"}
function mangleName(a,b){var c=b.v;if(a===null||c===null||c.charAt(0)!=="_"||c.charAt(1)!=="_")return b;if(c.charAt(c.length-1)==="_"&&c.charAt(c.length-2)==="_")return b;if(a.replace(/_/g,"")==="")return b;a=a.replace(/^_*/,"");return"_"+a+c}Compiler.prototype._gr=function(a){var b=this.gensym(a);out("var ",b,"=");for(var c=1;c<arguments.length;++c)out(arguments[c]);out(";");return b};
Compiler.prototype._jumpfalse=function(a,b){var c=this._gr("jfalse","(",a,"===false||!Sk.misceval.isTrue(",a,"))");out("if(",c,"){/*test failed */$blk=",b,";continue;}")};Compiler.prototype._jumpundef=function(a,b){out("if(",a,"===undefined){$blk=",b,";continue;}")};Compiler.prototype._jumptrue=function(a,b){var c=this._gr("jtrue","(",a,"===true||Sk.misceval.isTrue(",a,"))");out("if(",c,"){/*test passed */$blk=",b,";continue;}")};Compiler.prototype._jump=function(a){out("$blk=",a,";/* jump */continue;")};
Compiler.prototype.ctupleorlist=function(a,b,c){goog.asserts.assert(c==="tuple"||c==="list");if(a.ctx===Store)for(var d=0;d<a.elts.length;++d)this.vexpr(a.elts[d],"Sk.abstr.objectGetItem("+b+","+d+")");else if(a.ctx===Load){b=[];for(d=0;d<a.elts.length;++d)b.push(this._gr("elem",this.vexpr(a.elts[d])));return this._gr("load"+c,"new Sk.builtins['",c,"']([",b,"])")}};
Compiler.prototype.cdict=function(a){goog.asserts.assert(a.values.length===a.keys.length);for(var b=[],c=0;c<a.values.length;++c){var d=this.vexpr(a.values[c]);b.push(this.vexpr(a.keys[c]));b.push(d)}return this._gr("loaddict","new Sk.builtins['dict']([",b,"])")};
Compiler.prototype.clistcompgen=function(a,b,c,d){var e=this.newBlock("list gen start"),f=this.newBlock("list gen skip"),g=this.newBlock("list gen anchor"),h=b[c],i=this._gr("iter","Sk.abstr.iter(",this.vexpr(h.iter),")");this._jump(e);this.setBlock(e);i=this._gr("next","Sk.abstr.iternext(",i,")");this._jumpundef(i,g);this.vexpr(h.target,i);i=h.ifs.length;for(var j=0;j<i;++j)this._jumpfalse(this.vexpr(h.ifs[j]),e);++c<b.length&&this.clistcompgen(a,b,c,d);if(c>=b.length){b=this.vexpr(d);out(a,".v.push(",
b,");");this._jump(f);this.setBlock(f)}this._jump(e);this.setBlock(g);return a};Compiler.prototype.clistcomp=function(a){goog.asserts.assert(a instanceof ListComp);return this.clistcompgen(this._gr("_compr","new Sk.builtins['list']([])"),a.generators,0,a.elt)};
Compiler.prototype.cyield=function(a){if(this.u.ste.blockType!==FunctionBlock)throw new SyntaxError("'yield' outside function");var b="null";if(a.value)b=this.vexpr(a.value);a=this.newBlock("after yield");out("return [/*resume*/",a,",/*ret*/",b,"];");this.setBlock(a);return"null"};
Compiler.prototype.ccompare=function(a){var b=this.vexpr(a.left);goog.asserts.assert(a.ops.length===1&&a.comparators.length===1,"todo; >1 compares");goog.asserts.assert(a.ops.length===a.comparators.length);return this._gr("compare","Sk.misceval.richCompareBool(",b,",",this.vexpr(a.comparators[0]),",'",a.ops[0].prototype._astname,"')")};
Compiler.prototype.ccall=function(a){var b=this.vexpr(a.func),c=this.vseqexpr(a.args);goog.asserts.assert(!a.starargs,"todo;");goog.asserts.assert(!a.kwargs,"todo;");var d="undefined";if(a.keywords.length>0){d=[];for(var e=0;e<a.keywords.length;++e){d.push("'"+a.keywords[e].arg.v+"'");d.push(this.vexpr(a.keywords[e].value))}d="["+d.join(",")+"]"}return this._gr("call","Sk.misceval.call(",b,",",d,c.length>0?",":"",c,")")};
Compiler.prototype.csimpleslice=function(a,b,c,d){goog.asserts.assert(a.step===null);var e="null",f="null";if(a.lower)e=this.vexpr(a.lower);if(a.upper)f=this.vexpr(a.upper);switch(b){case AugLoad:case Load:return this._gr("simpsliceload","Sk.misceval.applySlice(",c,",",e,",",f,")");case AugStore:case Store:out("Sk.misceval.assignSlice(",c,",",e,",",f,",",d,");");break;case Del:out("Sk.misceval.assignSlice(",c,",",e,",",f,",null);");break;default:goog.asserts.fail("invalid simple slice")}};
Compiler.prototype.cslice=function(a){goog.asserts.assert(a instanceof Slice);var b=a.lower?this.vexpr(a.lower):"null",c=a.upper?this.vexpr(a.upper):"null";a=a.step?this.vexpr(a.step):"null";return this._gr("slice","new Sk.builtins['slice'](",b,",",c,",",a,")")};
Compiler.prototype.vslice=function(a,b,c,d){var e=null,f;switch(a.constructor){case Index:e="index";f=this.vexpr(a.value);break;case Slice:if(!a.step)return this.csimpleslice(a,b,c,d);if(b!==AugStore)f=this.cslice(a,b,c,d);break;case Ellipsis:case ExtSlice:goog.asserts.fail("todo;");break;default:goog.asserts.fail("invalid subscript kind")}return this.chandlesubscr(e,b,c,f,d)};
Compiler.prototype.chandlesubscr=function(a,b,c,d,e){if(b===Load||b===AugLoad)return this._gr("lsubscr","Sk.abstr.objectGetItem(",c,",",d,")");else if(b===Store||b===AugStore)out("Sk.abstr.objectSetItem(",c,",",d,",",e,");");else b===Del?out("Sk.abstr.objectDelItem(",c,",",d,");"):goog.asserts.fail("handlesubscr fail")};
Compiler.prototype.cboolop=function(a){goog.asserts.assert(a instanceof BoolOp);var b;b=a.op===And?this._jumpfalse:this._jumptrue;var c=this.newBlock("end of boolop");a=a.values;for(var d=a.length,e,f=0;f<d;++f){var g=this.vexpr(a[f]);if(f===0)e=this._gr("boolopsucc",g);out(e,"=",g,";");b.call(this,g,c)}this._jump(c);this.setBlock(c);return e};
Compiler.prototype.vexpr=function(a,b,c){if(a.lineno>this.u.lineno){this.u.lineno=a.lineno;this.u.linenoSet=false}switch(a.constructor){case BoolOp:return this.cboolop(a);case BinOp:return this._gr("binop","Sk.abstr.numberBinOp(",this.vexpr(a.left),",",this.vexpr(a.right),",'",a.op.prototype._astname,"')");case UnaryOp:return this._gr("unaryop","Sk.abstr.numberUnaryOp(",this.vexpr(a.operand),",'",a.op.prototype._astname,"')");case Lambda:return this.clambda(a);case IfExp:goog.asserts.fail();case Dict:return this.cdict(a);
case ListComp:return this.clistcomp(a);case GeneratorExp:return this.cgenexp(a);case Yield:return this.cyield(a);case Compare:return this.ccompare(a);case Call:return this.ccall(a);case Num:if(typeof a.n==="number")return a.n;else if(a.n instanceof Sk.builtin.lng)return"Sk.longFromStr('"+a.n.tp$str().v+"')";goog.asserts.fail("unhandled Num type");case Str:return this._gr("str","new Sk.builtins['str'](",a.s.$r().v,")");case Attribute:var d;if(a.ctx!==AugStore)d=this.vexpr(a.value);switch(a.ctx){case AugLoad:case Load:return this._gr("lattr",
"Sk.abstr.gattr(",d,",",a.attr.$r().v,")");case AugStore:out("if(",b,"!==undefined){");d=this.vexpr(c||null);out("Sk.abstr.sattr(",d,",",a.attr.$r().v,",",b,");");out("}");break;case Store:out("Sk.abstr.sattr(",d,",",a.attr.$r().v,",",b,");");break;case Del:goog.asserts.fail("todo;");break;default:goog.asserts.fail("invalid attribute expression")}break;case Subscript:switch(a.ctx){case AugLoad:case Load:case Store:case Del:return this.vslice(a.slice,a.ctx,this.vexpr(a.value),b);case AugStore:out("if(",
b,"!==undefined){");d=this.vexpr(c||null);this.vslice(a.slice,a.ctx,d,b);out("}");break;default:goog.asserts.fail("invalid subscript expression")}break;case Name:return this.nameop(a.id,a.ctx,b);case List:return this.ctupleorlist(a,b,"list");case Tuple:return this.ctupleorlist(a,b,"tuple");default:goog.asserts.fail("unhandled case in vexpr")}};
Compiler.prototype.vseqexpr=function(a,b){goog.asserts.assert(b===undefined||a.length===b.length);for(var c=[],d=0;d<a.length;++d)c.push(this.vexpr(a[d],b===undefined?undefined:b[d]));return c};
Compiler.prototype.caugassign=function(a){goog.asserts.assert(a instanceof AugAssign);var b=a.target;switch(b.constructor){case Attribute:var c=new Attribute(b.value,b.attr,AugLoad,b.lineno,b.col_offset),d=this.vexpr(c),e=this.vexpr(a.value);a=this._gr("inplbinopattr","Sk.abstr.numberInplaceBinOp(",d,",",e,",'",a.op.prototype._astname,"')");c.ctx=AugStore;return this.vexpr(c,a,b.value);case Subscript:c=new Subscript(b.value,b.slice,AugLoad,b.lineno,b.col_offset);d=this.vexpr(c);e=this.vexpr(a.value);
a=this._gr("inplbinopsubscr","Sk.abstr.numberInplaceBinOp(",d,",",e,",'",a.op.prototype._astname,"')");c.ctx=AugStore;return this.vexpr(c,a,b.value);case Name:c=this.nameop(b.id,Load);e=this.vexpr(a.value);a=this._gr("inplbinop","Sk.abstr.numberInplaceBinOp(",c,",",e,",'",a.op.prototype._astname,"')");return this.nameop(b.id,Store,a);default:goog.asserts.fail("unhandled case in augassign")}};
Compiler.prototype.exprConstant=function(a){switch(a.constructor){case Num:return Sk.misceval.isTrue(a.n);case Str:return Sk.misceval.isTrue(a.s);default:return-1}};Compiler.prototype.newBlock=function(a){var b=this.u.blocknum++;this.u.blocks[b]=[];this.u.blocks[b]._name=a||"<unnamed>";return b};Compiler.prototype.setBlock=function(a){goog.asserts.assert(a>=0&&a<this.u.blocknum);this.u.curblock=a};Compiler.prototype.pushBreakBlock=function(a){goog.asserts.assert(a>=0&&a<this.u.blocknum);this.u.breakBlocks.push(a)};
Compiler.prototype.popBreakBlock=function(){this.u.breakBlocks.pop()};Compiler.prototype.pushContinueBlock=function(a){goog.asserts.assert(a>=0&&a<this.u.blocknum);this.u.continueBlocks.push(a)};Compiler.prototype.popContinueBlock=function(){this.u.continueBlocks.pop()};
Compiler.prototype.outputLocals=function(a){for(var b={},c=0;a.argnames&&c<a.argnames.length;++c)b[a.argnames[c]]=true;a.localnames.sort();var d=[];for(c=0;c<a.localnames.length;++c){var e=a.localnames[c];if(b[e]===undefined){d.push(e);b[e]=true}}if(d.length>0)return"var "+d.join(",")+"; /* locals */";return""};
Compiler.prototype.outputAllUnits=function(){for(var a="",b=0;b<this.allUnits.length;++b){var c=this.allUnits[b];a+=c.prefixCode;a+=this.outputLocals(c);a+=c.varDeclsCode;a+=c.switchCode;for(var d=c.blocks,e=0;e<d.length;++e){a+="case "+e+": /* --- "+d[e]._name+" --- */";a+=d[e].join("");a+="goog.asserts.fail('unterminated block');"}a+=c.suffixCode}return a};
Compiler.prototype.cif=function(a){goog.asserts.assert(a instanceof If_);var b=this.exprConstant(a.test);if(b===0)a.orelse&&this.vseqstmt(a.orelse);else if(b===1)this.vseqstmt(a.body);else{var c=this.newBlock("end of if");b=this.newBlock("next branch of if");this.vexpr(a.test);this._jumpfalse(this.vexpr(a.test),b);this.vseqstmt(a.body);this._jump(c);this.setBlock(b);a.orelse&&this.vseqstmt(a.orelse);this._jump(c)}this.setBlock(c)};
Compiler.prototype.cwhile=function(a){if(this.exprConstant(a.test)===0)a.orelse&&this.vseqstmt(a.orelse);else{var b=this.newBlock("while test");this._jump(b);this.setBlock(b);var c=this.newBlock("after while"),d=a.orelse.length>0?this.newBlock("while orelse"):null,e=this.newBlock("while body");this._jumpfalse(this.vexpr(a.test),d?d:c);this._jump(e);this.pushBreakBlock(c);this.pushContinueBlock(b);this.setBlock(e);this.vseqstmt(a.body);this._jump(b);this.popContinueBlock();this.popBreakBlock();if(a.orelse.length>
0){this.setBlock(d);this.vseqstmt(a.orelse)}this.setBlock(c)}};
Compiler.prototype.cfor=function(a){var b=this.newBlock("for start"),c=this.newBlock("for cleanup"),d=this.newBlock("for end");this.pushBreakBlock(d);this.pushContinueBlock(b);var e=this.vexpr(a.iter),f;if(this.u.ste.generator){f="$loc."+this.gensym("iter");out(f,"=Sk.abstr.iter(",e,");")}else f=this._gr("iter","Sk.abstr.iter(",e,")");this._jump(b);this.setBlock(b);e=this._gr("next","Sk.abstr.iternext(",f,")");this._jumpundef(e,c);this.vexpr(a.target,e);this.vseqstmt(a.body);this._jump(b);this.setBlock(c);
this.popContinueBlock();this.popBreakBlock();this.vseqstmt(a.orelse);this._jump(d);this.setBlock(d)};Compiler.prototype.craise=function(a){goog.asserts.assert(a.type.id.v==="StopIteration","only support 'raise' of StopIteration currently");out("return undefined;")};Compiler.prototype.cassert=function(a){var b=this.vexpr(a.test),c=this.newBlock("end");this._jumptrue(b,c);out("throw new Sk.builtins['AssertionError'](",a.msg?this.vexpr(a.msg):"",");");this.setBlock(c)};
Compiler.prototype.cimportas=function(a,b,c){a=a.v;var d=a.indexOf(".");c=c;if(d!==-1)for(a=a.substr(d+1);d!==-1;){d=a.indexOf(".");var e=d!==-1?a.substr(0,d):a;c=this._gr("lattr","Sk.abstr.gattr(",c,",'",e,"')");a=a.substr(d+1)}return this.nameop(b,Store,c)};
Compiler.prototype.cimport=function(a){for(var b=a.names.length,c=0;c<b;++c){var d=a.names[c],e=this._gr("module","Sk.builtin.__import__(",d.name.$r().v,",$gbl,$loc,[])");if(d.asname)this.cimportas(d.name,d.asname,e);else{d=d.name;var f=d.v.indexOf(".");if(f!==-1)d=new Sk.builtin.str(d.v.substr(0,f));this.nameop(d,Store,e)}}};
Compiler.prototype.cfromimport=function(a){for(var b=a.names.length,c=[],d=0;d<b;++d)c[d]=a.names[d].name.$r().v;c=this._gr("module","Sk.builtin.__import__(",a.module.$r().v,",$gbl,$loc,[",c,"])");for(d=0;d<b;++d){var e=a.names[d];if(d===0&&e.name==="*"){goog.asserts.assert(b===1);out("Sk.importStar(",c,");");break}var f=this._gr("item","Sk.abstr.gattr(",c,",",e.name.$r().v,")"),g=e.name;if(e.asname)g=e.asname;this.nameop(g,Store,f)}};
Compiler.prototype.buildcodeobj=function(a,b,c,d,e){var f=[];c&&this.vseqexpr(c);if(d&&d.defaults)f=this.vseqexpr(d.defaults);a=this.enterScope(b,a,a.lineno);c=this.u.ste.generator;var g=this.u.ste.hasFree,h=this.u.ste.childHasFree,i=this.newBlock("codeobj entry");this.u.prefixCode="var "+a+"=(function "+this.niceName(b.v)+"$(";var j=[];if(c)j.push("$gen");else for(b=0;d&&b<d.args.length;++b)j.push(this.nameop(d.args[b].id,Param));g&&j.push("$free");this.u.prefixCode+=j.join(",");this.u.prefixCode+=
"){";if(c)this.u.prefixCode+="\n// generator\n";if(g)this.u.prefixCode+="\n// has free\n";if(h)this.u.prefixCode+="\n// has cell\n";b="{}";if(c){i="$gen.gi$resumeat";b="$gen.gi$locals"}j="";if(h)j=",$cell={}";this.u.varDeclsCode+="var $blk="+i+",$loc="+b+j+",$gbl=this;";for(b=0;d&&b<d.args.length;++b){h=d.args[b].id;if(this.isCell(h))this.u.varDeclsCode+="$cell."+h.v+"="+h.v+";"}if(f.length>0){h=d.args.length-f.length;for(b=0;b<f.length;++b){i=this.nameop(d.args[b+h].id,Param);this.u.varDeclsCode+=
"if("+i+"===undefined)"+i+"="+a+".$defaults["+b+"];"}}this.u.switchCode+="while(true){switch($blk){";this.u.suffixCode="}break;}});";e.call(this,a);var k;if(d&&d.args.length>0){e=[];for(b=0;b<d.args.length;++b)e.push(d.args[b].id.v);k=e.join("', '");this.u.argnames=e}this.exitScope();f.length>0&&out(a,".$defaults=[",f.join(","),"];");k&&out(a,".co_varnames=['",k,"'];");f="";if(g){f=",$cell";if(this.u.ste.hasFree)f+=",$free"}return c?d&&d.args.length>0?this._gr("gener","(function(){var $origargs=Array.prototype.slice.call(arguments);return new Sk.builtins['generator'](",
a,",$gbl,$origargs",f,");})"):this._gr("gener","(function(){return new Sk.builtins['generator'](",a,",$gbl,[]",f,");})"):this._gr("funcobj","new Sk.builtins['function'](",a,",$gbl",f,")")};Compiler.prototype.cfunction=function(a){goog.asserts.assert(a instanceof FunctionDef);var b=this.buildcodeobj(a,a.name,a.decorator_list,a.args,function(){this.vseqstmt(a.body);out("return null;")});this.nameop(a.name,Store,b)};
Compiler.prototype.clambda=function(a){goog.asserts.assert(a instanceof Lambda);return this.buildcodeobj(a,new Sk.builtin.str("<lambda>"),null,a.args,function(){var b=this.vexpr(a.body);out("return ",b,";")})};
Compiler.prototype.cgenexpgen=function(a,b,c){var d=this.newBlock("start for "+b),e=this.newBlock("skip for "+b);this.newBlock("if cleanup for "+b);var f=this.newBlock("end for "+b),g=a[b],h;if(b===0)h="$loc.$iter0";else{var i=this.vexpr(g.iter);h="$loc."+this.gensym("iter");out(h,"=","Sk.abstr.iter(",i,");")}this._jump(d);this.setBlock(d);h=this._gr("next","Sk.abstr.iternext(",h,")");this._jumpundef(h,f);this.vexpr(g.target,h);h=g.ifs.length;for(i=0;i<h;++i)this._jumpfalse(this.vexpr(g.ifs[i]),d);
++b<a.length&&this.cgenexpgen(a,b,c);if(b>=a.length){a=this.vexpr(c);out("return [",e,"/*resume*/,",a,"/*ret*/];");this.setBlock(e)}this._jump(d);this.setBlock(f);b===1&&out("return null;")};Compiler.prototype.cgenexp=function(a){var b=this._gr("gener",this.buildcodeobj(a,new Sk.builtin.str("<genexpr>"),null,null,function(){this.cgenexpgen(a.generators,0,a.elt)}),"()");out(b,".gi$locals.$iter0=Sk.abstr.iter(",this.vexpr(a.generators[0].iter),");");return b};
Compiler.prototype.cclass=function(a){goog.asserts.assert(a instanceof ClassDef);var b=this.vseqexpr(a.bases),c=this.enterScope(a.name,a,a.lineno),d=this.newBlock("class entry");this.u.prefixCode="var "+c+"=(function $"+a.name.v+"$class_outer($globals,$locals,$rest){var $gbl=$globals,$loc=$locals;";this.u.switchCode+="return(function "+a.name.v+"(){";this.u.switchCode+="var $blk="+d+";while(true){switch($blk){";this.u.suffixCode="}break;}}).apply(null,$rest);});";this.u.private_=a.name;this.cbody(a.body);
out("break;");this.exitScope();b=this._gr("built","Sk.misceval.buildClass($gbl,",c,",",a.name.$r().v,",[",b,"])");this.nameop(a.name,Store,b)};Compiler.prototype.ccontinue=function(){if(this.u.continueBlocks.length===0)throw new SyntaxError("'continue' outside loop");this._jump(this.u.continueBlocks[this.u.continueBlocks.length-1])};
Compiler.prototype.vstmt=function(a){this.u.lineno=a.lineno;this.u.linenoSet=false;this.annotateSource(a);switch(a.constructor){case FunctionDef:this.cfunction(a);break;case ClassDef:this.cclass(a);break;case Return_:if(this.u.ste.blockType!==FunctionBlock)throw new SyntaxError("'return' outside function");a.value?out("return ",this.vexpr(a.value),";"):out("return null;");break;case Delete_:this.vseqexpr(a.targets);break;case Assign:for(var b=a.targets.length,c=this.vexpr(a.value),d=0;d<b;++d)this.vexpr(a.targets[d],
c);break;case AugAssign:return this.caugassign(a);case Print:this.cprint(a);break;case For_:return this.cfor(a);case While_:return this.cwhile(a);case If_:return this.cif(a);case Raise:return this.craise(a);case Assert:return this.cassert(a);case Import_:return this.cimport(a);case ImportFrom:return this.cfromimport(a);case Global:break;case Expr:this.vexpr(a.value);break;case Pass:break;case Break_:if(this.u.breakBlocks.length===0)throw new SyntaxError("'break' outside loop");this._jump(this.u.breakBlocks[this.u.breakBlocks.length-
1]);break;case Continue_:this.ccontinue(a);break;default:goog.asserts.fail("unhandled case in vstmt")}};Compiler.prototype.vseqstmt=function(a){for(var b=0;b<a.length;++b)this.vstmt(a[b])};var OP_FAST=0,OP_GLOBAL=1,OP_DEREF=2,OP_NAME=3,D_NAMES=0,D_FREEVARS=1,D_CELLVARS=2;Compiler.prototype.isCell=function(a){if(this.u.ste.getScope(mangleName(this.u.private_,a).v)===CELL)return true;return false};
Compiler.prototype.nameop=function(a,b,c){if((b===Store||b===AugStore||b===Del)&&a.v==="__debug__")this.error("can not assign to __debug__");if((b===Store||b===AugStore||b===Del)&&a.v==="None")this.error("can not assign to None");if(a.v==="None")return"null";if(a.v==="True")return"true";if(a.v==="False")return"false";var d=mangleName(this.u.private_,a).v,e=OP_NAME,f=this.u.ste.getScope(d),g=null;switch(f){case FREE:g="$free";e=OP_DEREF;break;case CELL:g="$cell";e=OP_DEREF;break;case LOCAL:if(this.u.ste.blockType===
FunctionBlock&&!this.u.ste.generator)e=OP_FAST;break;case GLOBAL_IMPLICIT:if(this.u.ste.blockType===FunctionBlock)e=OP_GLOBAL;break;case GLOBAL_EXPLICIT:e=OP_GLOBAL}d=fixReservedWords(d);goog.asserts.assert(f||a.v.charAt(1)==="_");a=d;if(this.u.ste.generator||this.u.ste.blockType!==FunctionBlock)d="$loc."+d;else if(e===OP_FAST||e===OP_NAME)this.u.localnames.push(d);switch(e){case OP_FAST:switch(b){case Load:case Param:return d;case Store:out(d,"=",c,";");break;case Del:out("delete ",d,";");break;
default:goog.asserts.fail("unhandled")}break;case OP_NAME:switch(b){case Load:b=this.gensym("loadname");out("var ",b,"=",d,"!==undefined?",d,":Sk.misceval.loadname('",a,"',$gbl);");return b;case Store:out(d,"=",c,";");break;case Del:out("delete ",d,";");break;case Param:return d;default:goog.asserts.fail("unhandled")}break;case OP_GLOBAL:switch(b){case Load:return this._gr("loadgbl","Sk.misceval.loadname('",a,"',$gbl)");case Store:out("$gbl.",a,"=",c,";");break;case Del:out("delete $gbl.",a);break;
default:goog.asserts.fail("unhandled case in name op_global")}break;case OP_DEREF:switch(b){case Load:return g+"."+a;case Store:out(g,".",a,"=",c,";");break;case Param:return a;default:goog.asserts.fail("unhandled case in name op_deref")}break;default:goog.asserts.fail("unhandled case")}};
Compiler.prototype.enterScope=function(a,b,c){var d=new CompilerUnit;d.ste=this.st.getStsForAst(b);d.name=a;d.firstlineno=c;this.stack.push(this.u);this.allUnits.push(d);a=this.gensym("scope");d.scopename=a;this.u=d;this.u.activateScope();this.nestlevel++;return a};
Compiler.prototype.exitScope=function(){var a=this.u;this.nestlevel--;(this.u=this.stack.length-1>=0?this.stack.pop():null)&&this.u.activateScope();a.name.v!=="<module>"&&out(a.scopename,".co_name=new Sk.builtins['str'](",a.name.$r().v,");")};Compiler.prototype.cbody=function(a){for(var b=0;b<a.length;++b)this.vstmt(a[b])};
Compiler.prototype.cprint=function(a){goog.asserts.assert(a instanceof Print);a.dest&&this.vexpr(a.dest);for(var b=a.values.length,c=0;c<b;++c)out("Sk.misceval.print_(","new Sk.builtins['str'](",this.vexpr(a.values[c]),").v);");a.nl&&out("Sk.misceval.print_(",'"\\n");')};
Compiler.prototype.cmod=function(a){var b=this.enterScope(new Sk.builtin.str("<module>"),a,0),c=this.newBlock("module entry");this.u.prefixCode="var "+b+"=(function($modname){";this.u.varDeclsCode="var $blk="+c+",$gbl={},$loc=$gbl;$gbl.__name__=$modname;";this.u.switchCode="while(true){switch($blk){";this.u.suffixCode="}}});";switch(a.constructor){case Module:this.cbody(a.body);out("return $loc;");break;default:goog.asserts.fail("todo; unhandled case in compilerMod")}this.exitScope();this.result.push(this.outputAllUnits());
return b};Sk.compile=function(a,b){var c=Sk.parse(b,a);c=Sk.astFromParse(c,b);var d=Sk.symboltable(c,b);d=new Compiler(b,d,0,a);c=d.cmod(c);d=d.result.join("");return{funcname:c,code:d}};goog.exportSymbol("Sk.compile",Sk.compile);Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=undefined;Sk.importSearchPathForName=function(a,b,c){for(var d=Sk.realsyspath.tp$iter(),e=d.tp$iternext();e!==undefined;e=d.tp$iternext()){var f=a.replace(/\./g,"/");e=[e.v+"/"+f+b,e.v+"/"+f+"/__init__"+b];for(f=0;f<e.length;++f){var g=e[f];try{Sk.read(g);return g}catch(h){}}}if(!c)throw new Sk.builtin.ImportError("No module named "+a);};
Sk.doOneTimeInitialization=function(){Sk.builtin.type.basesStr_=new Sk.builtin.str("__bases__");Sk.builtin.type.mroStr_=new Sk.builtin.str("__mro__");Sk.builtin.object.$d=new Sk.builtin.dict([]);Sk.builtin.object.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,new Sk.builtin.tuple([]));Sk.builtin.object.$d.mp$ass_subscript(Sk.builtin.type.mroStr_,new Sk.builtin.tuple([Sk.builtin.object]))};
Sk.importSetUpPath=function(){if(!Sk.realsyspath){for(var a=[new Sk.builtin.str("src/builtin"),new Sk.builtin.str("src/lib"),new Sk.builtin.str(".")],b=0;b<Sk.syspath.length;++b)a.push(new Sk.builtin.str(Sk.syspath[b]));Sk.realsyspath=new Sk.builtin.list(a);Sk.doOneTimeInitialization()}};if(COMPILED)var js_beautify=function(a){return a};
Sk.importModuleInternal_=function(a,b,c,d){Sk.importSetUpPath();if(c===undefined)c=a;var e=null,f=c.split("."),g,h=Sk.sysmodules.mp$subscript(c);if(h!==undefined)return f.length>1?Sk.sysmodules.mp$subscript(f[0]):h;if(f.length>1){g=f.slice(0,f.length-1).join(".");e=Sk.importModuleInternal_(g,b)}h=new Sk.builtin.module;Sk.sysmodules.mp$ass_subscript(a,h);var i;if(d){a=a+".py";i=Sk.compile(d,a,"exec")}else if(d=Sk.importSearchPathForName(a,".js",true)){a=d;i={funcname:"$builtinmodule",code:Sk.read(a)}}else{a=
Sk.importSearchPathForName(a,".py");i=Sk.compile(Sk.read(a),a,"exec")}a=h.$js=i.code;if(b){Sk.debugout("-----");a=function(){for(var j=js_beautify(i.code).split("\n"),k=1;k<=j.length;++k){for(var l="",n=(""+k).length;n<5;++n)l+=" ";j[k-1]="/* "+l+k+" */ "+j[k-1]}return j.join("\n")}(i.code);Sk.debugout(a)}a+="\n"+i.funcname+"("+("new Sk.builtin.str('"+c+"')")+");";b=goog.global.eval(a);b.__name__||(b.__name__=new Sk.builtin.str(c));h.$d=b;if(e){Sk.sysmodules.mp$subscript(g).tp$setattr(f[f.length-
1],h);return e}return h};Sk.importModule=function(a,b){return Sk.importModuleInternal_(a,b)};Sk.importMain=function(a,b){return Sk.importModuleInternal_(a,b,"__main__")};Sk.importMainWithBody=function(a,b,c){return Sk.importModuleInternal_(a,b,"__main__",c)};Sk.builtin.__import__=function(a,b,c,d){b=Sk.importModuleInternal_(a);if(!d||d.length===0)return b;b=Sk.sysmodules.mp$subscript(a);goog.asserts.assert(b);return b};goog.exportSymbol("Sk.importMain",Sk.importMain);
goog.exportSymbol("Sk.importMainWithBody",Sk.importMainWithBody);goog.exportSymbol("Sk.builtin.__import__",Sk.builtin.__import__);Sk.builtins={range:Sk.builtin.range,len:Sk.builtin.len,min:Sk.builtin.min,max:Sk.builtin.max,abs:Sk.builtin.abs,ord:Sk.builtin.ord,chr:Sk.builtin.chr,dir:Sk.builtin.dir,repr:Sk.builtin.repr,open:Sk.builtin.open,isinstance:Sk.builtin.isinstance,hash:Sk.builtin.hash,getattr:Sk.builtin.getattr,float_$rw$:Sk.builtin.float_,int_$rw$:Sk.builtin.int_,dict:Sk.builtin.dict,file:Sk.builtin.file,"function":Sk.builtin.func,generator:Sk.builtin.generator,list:Sk.builtin.list,long_$rw$:Sk.builtin.lng,method:Sk.builtin.method,
object:Sk.builtin.object,slice:Sk.builtin.slice,str:Sk.builtin.str,tuple:Sk.builtin.tuple,type:Sk.builtin.type};goog.exportSymbol("Sk.builtins",Sk.builtins);}());

View file

@ -0,0 +1,27 @@
// Underscore.js 1.1.7
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function(){var p=this,C=p._,m={},i=Array.prototype,n=Object.prototype,f=i.slice,D=i.unshift,E=n.toString,l=n.hasOwnProperty,s=i.forEach,t=i.map,u=i.reduce,v=i.reduceRight,w=i.filter,x=i.every,y=i.some,o=i.indexOf,z=i.lastIndexOf;n=Array.isArray;var F=Object.keys,q=Function.prototype.bind,b=function(a){return new j(a)};typeof module!=="undefined"&&module.exports?(module.exports=b,b._=b):p._=b;b.VERSION="1.1.7";var h=b.each=b.forEach=function(a,c,b){if(a!=null)if(s&&a.forEach===s)a.forEach(c,b);else if(a.length===
+a.length)for(var e=0,k=a.length;e<k;e++){if(e in a&&c.call(b,a[e],e,a)===m)break}else for(e in a)if(l.call(a,e)&&c.call(b,a[e],e,a)===m)break};b.map=function(a,c,b){var e=[];if(a==null)return e;if(t&&a.map===t)return a.map(c,b);h(a,function(a,g,G){e[e.length]=c.call(b,a,g,G)});return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var k=d!==void 0;a==null&&(a=[]);if(u&&a.reduce===u)return e&&(c=b.bind(c,e)),k?a.reduce(c,d):a.reduce(c);h(a,function(a,b,f){k?d=c.call(e,d,a,b,f):(d=a,k=!0)});if(!k)throw new TypeError("Reduce of empty array with no initial value");
return d};b.reduceRight=b.foldr=function(a,c,d,e){a==null&&(a=[]);if(v&&a.reduceRight===v)return e&&(c=b.bind(c,e)),d!==void 0?a.reduceRight(c,d):a.reduceRight(c);a=(b.isArray(a)?a.slice():b.toArray(a)).reverse();return b.reduce(a,c,d,e)};b.find=b.detect=function(a,c,b){var e;A(a,function(a,g,f){if(c.call(b,a,g,f))return e=a,!0});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(w&&a.filter===w)return a.filter(c,b);h(a,function(a,g,f){c.call(b,a,g,f)&&(e[e.length]=a)});return e};
b.reject=function(a,c,b){var e=[];if(a==null)return e;h(a,function(a,g,f){c.call(b,a,g,f)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=!0;if(a==null)return e;if(x&&a.every===x)return a.every(c,b);h(a,function(a,g,f){if(!(e=e&&c.call(b,a,g,f)))return m});return e};var A=b.some=b.any=function(a,c,d){c=c||b.identity;var e=!1;if(a==null)return e;if(y&&a.some===y)return a.some(c,d);h(a,function(a,b,f){if(e|=c.call(d,a,b,f))return m});return!!e};b.include=b.contains=function(a,c){var b=
!1;if(a==null)return b;if(o&&a.indexOf===o)return a.indexOf(c)!=-1;A(a,function(a){if(b=a===c)return!0});return b};b.invoke=function(a,c){var d=f.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,
c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b<e.computed&&(e={value:a,computed:b})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,f){return{value:a,criteria:c.call(d,a,b,f)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,b){var d={};h(a,function(a,f){var g=b(a,f);(d[g]||(d[g]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||
(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return f.call(a);if(b.isArguments(a))return f.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?f.call(a,0,b):a[0]};b.rest=b.tail=function(a,b,d){return f.call(a,b==null||d?1:b)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.filter(a,
function(a){return!!a})};b.flatten=function(a){return b.reduce(a,function(a,d){if(b.isArray(d))return a.concat(b.flatten(d));a[a.length]=d;return a},[])};b.without=function(a){return b.difference(a,f.call(arguments,1))};b.uniq=b.unique=function(a,c){return b.reduce(a,function(a,e,f){if(0==f||(c===!0?b.last(a)!=e:!b.include(a,e)))a[a.length]=e;return a},[])};b.union=function(){return b.uniq(b.flatten(arguments))};b.intersection=b.intersect=function(a){var c=f.call(arguments,1);return b.filter(b.uniq(a),
function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a,c){return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=f.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(o&&a.indexOf===o)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,
b){if(a==null)return-1;if(z&&a.lastIndexOf===z)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);d=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};b.bind=function(a,b){if(a.bind===q&&q)return q.apply(a,f.call(arguments,1));var d=f.call(arguments,2);return function(){return a.apply(b,d.concat(f.call(arguments)))}};b.bindAll=function(a){var c=f.call(arguments,1);
c.length==0&&(c=b.functions(a));h(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var b=c.apply(this,arguments);return l.call(d,b)?d[b]:d[b]=a.apply(this,arguments)}};b.delay=function(a,b){var d=f.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(f.call(arguments,1)))};var B=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;
a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};b.throttle=function(a,b){return B(a,b,!1)};b.debounce=function(a,b){return B(a,b,!0)};b.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(f.call(arguments));return b.apply(this,d)}};b.compose=function(){var a=f.call(arguments);return function(){for(var b=f.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=
function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}};b.keys=F||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)l.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){h(f.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){h(f.call(arguments,
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,c){if(a===c)return!0;var d=typeof a;if(d!=typeof c)return!1;if(a==c)return!0;if(!a&&c||a&&!c)return!1;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual)return a.isEqual(c);if(c.isEqual)return c.isEqual(a);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return!1;
if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return!1;if(a.length&&a.length!==c.length)return!1;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return!1;for(var f in a)if(!(f in c)||!b.isEqual(a[f],c[f]))return!1;return!0};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(l.call(a,c))return!1;return!0};b.isElement=function(a){return!!(a&&a.nodeType==
1)};b.isArray=n||function(a){return E.call(a)==="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return!(!a||!l.call(a,"callee"))};b.isFunction=function(a){return!(!a||!a.constructor||!a.call||!a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===!0||a===!1};b.isDate=function(a){return!(!a||!a.getTimezoneOffset||
!a.setUTCFullYear)};b.isRegExp=function(a){return!(!a||!a.test||!a.exec||!(a.ignoreCase||a.ignoreCase===!1))};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){p._=C;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.mixin=function(a){h(b.functions(a),function(c){H(c,b[c]=a[c])})};var I=0;b.uniqueId=function(a){var b=I++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};
b.template=function(a,c){var d=b.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return c?d(c):d};
var j=function(a){this._wrapped=a};b.prototype=j.prototype;var r=function(a,c){return c?b(a).chain():a},H=function(a,c){j.prototype[a]=function(){var a=f.call(arguments);D.call(a,this._wrapped);return r(c.apply(b,a),this._chain)}};b.mixin(b);h(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=i[a];j.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});h(["concat","join","slice"],function(a){var b=i[a];j.prototype[a]=function(){return r(b.apply(this._wrapped,
arguments),this._chain)}});j.prototype.chain=function(){this._chain=!0;return this};j.prototype.value=function(){return this._wrapped}})();

View file

@ -0,0 +1,103 @@
/** Stylesheet for the puzzles */
.sortable-code {
padding-left: 0px;
margin-left: 2%;
float: left;
}
#sortableTrash { width: 38%; }
#sortable { width: 56%; }
.sortable-code ul {
font-size: 120%;
font-family: monospace;
list-style: none;
background-color: #efefff;
padding-bottom: 10px;
padding-left: 0;
margin-left: 0;
border: 1px solid #efefff;;
}
ul.output {
background-color: #FFA;
}
.sortable-code li {
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius: 10px;
background-color:#EFEFEF;
border:1px solid lightgray;
padding:10px;
margin-top: 5px;
white-space: nowrap;
overflow: hidden;
cursor: move;
}
.sortable-code li:hover {
overflow: visible;
}
ul.incorrect {
border: 1px solid red;
background-color: #ffefef;
}
ul.correct {
background-color: #efffef;
background-color: #DFF2BF;
}
li.incorrectIndent {
border: 1px solid red;
border-left: 10px solid red;
}
li.correctIndent {
border: 1px solid green;
border-left: 10px solid green;
}
li.incorrectPosition, .testcase.incorrect {
background-color: #FFBABA;
border:1px solid red;
}
li.correctPosition, .testcase.correct {
background-color: #DFF2BF;
border:1px solid green;
}
.testcase { padding: 10px; margin-bottom: 10px;}
.testcase .errormsg { color: red;}
.testcase .msg { font-weight: bolder;}
.testcase.incorrect .expected, .testcase.incorrect .actual {
color: red;
font-weight: bolder;
}
.testcase .output {
display: block;
white-space: pre;
background-color: #555555;
color: white;
font-size: 12px;
line-height: 15px;
margin: 5px;
padding: 5px;
}
/** For styling the toggleable elements */
.jsparson-toggle {
padding: 0 15px;
display: inline-block;
border: 1px dashed black;
z-index: 500;
cursor: pointer;
min-width: 10px;
min-height: 15px;
}
.jsparson-toggle:empty {
border-color: red;
}
.jsparson-toggle:empty:before {
content: "??";
display: block;
color: red;
}

View file

@ -0,0 +1,781 @@
(function($, _) { // wrap in anonymous function to not show some helper variables
// regexp used for trimming
var trimRegexp = /^\s*(.*?)\s*$/;
var formatVariableValue = function(varValue) {
var varType = typeof varValue;
if (varType === "undefined" || varValue === null) {
return "None";
} else if (varType === "string") { // show strings in quotes
return '"' + varValue + '"';
} else if (varType === "boolean") { // Python booleans with capital first letter
return varValue?"True":"False";
} else if ($.isArray(varValue)) { // JavaScript arrays
return '[' + varValue.join(', ') + ']';
} else if (varType === "object" && varValue.tp$name === "str") { // Python strings
return '"' + varValue.v + '"';
} else if (varType === "object" && varValue.tp$name === "list") { // Python lists
return '[' + varValue.v.join(', ') + ']';
} else {
return varValue;
}
};
var translations = {
fi: {
order: function() {
return "Ohjelma sisältää vääriä palasia tai palasten järjestys on väärä. Tämä on mahdollista korjata siirtämällä, poistamalla tai vaihtamalla korostettuja palasia.";},
lines_missing: function() {
return "Ohjelmassasi on liian vähän palasia, jotta se toimisi oikein.";},
no_matching: function(lineNro) {
return "Korostettu palanen (" + lineNro + ") on sisennetty Pythonin kieliopin vastaisesti."; },
block_structure: function(lineNro) {
return "Korostettu palanen (" + lineNro + ") on sisennetty väärään koodilohkoon."; },
unittest_error: function(errormsg) {
return "Virhe ohjelman jäsentämisessä/suorituksessa: <span class='errormsg'>" + errormsg + "</span>";
},
unittest_output_assertion: function(expected, actual) {
return "Odotettu tulostus: <span class='expected output'>" + expected + "</span>" +
"Ohjelmasi tulostus: <span class='actual output'>" + actual + "</span>";
},
unittest_assertion: function(expected, actual) {
return "Odotettu arvo: <span class='expected'>" + expected + "</span><br>" +
"Ohjelmasi antama arvo: <span class='actual'>" + actual + "</span>";
}
},
en: {
order: function() {
return "Code fragments in your program are wrong, or in wrong order. This can be fixed by moving, removing, or replacing highlighted fragments.";},
lines_missing: function() {
return "Your program has too few code fragments.";},
no_matching: function(lineNro) {
return "Based on python syntax, the highlighted fragment (" + lineNro + ") is not correctly indented."; },
block_structure: function(lineNro) { return "The highlighted fragment " + lineNro + " belongs to a wrong block (i.e. indentation)."; },
unittest_error: function(errormsg) {
return "Error in parsing/executing your program: <span class='errormsg'>" + errormsg + "</span>";
},
unittest_output_assertion: function(expected, actual) {
return "Expected output: <span class='expected output'>" + expected + "</span>" +
"Output of your program: <span class='actual output'>" + actual + "</span>";
},
unittest_assertion: function(expected, actual) {
return "Expected value: <span class='expected'>" + expected + "</span><br>" +
"Actual value: <span class='actual'>" + actual + "</span>";
}
},
enold: {
order: function() {
return "Some lines in incorrect position relative to the others.";},
lines_missing: function() {
return "Too few lines in your solution.";},
no_matching: function(lineNro) {
return "Line " + lineNro + " is not correctly indented. No matching indentation."; },
block_structure: function(lineNro) { return "Line " + lineNro + " is not indented correctly."; },
unittest_error: function(errormsg) {
return "Error in parsing/executing your program: <span class='errormsg'>" + errormsg + "</span>";
},
unittest_output_assertion: function(expected, actual) {
return "Expected output: <span class='expected output'>" + expected + "</span>" +
"Output of your program: <span class='actual output'>" + actual + "</span>";
},
unittest_assertion: function(expected, actual) {
return "Expected value: <span class='expected'>" + expected + "</span><br>" +
"Actual value: <span class='actual'>" + actual + "</span>";
}
}
};
var python_exec = function(code, variables) {
var output = "",
mainmod,
result = {'variables': {}},
varname;
Sk.configure( { output: function(str) { output += str; } } );
try {
mainmod = Sk.importMainWithBody("<stdin>", false, code);
} catch (e) {
return {"_output": output, "_error": "" + e};
}
for (var i = 0; i < variables.length; i++) {
varname = variables[i];
result.variables[varname] = mainmod.tp$getattr(varname);
}
result._output = output;
return result;
};
var python_indents = [],
spaces = "";
for (var counter = 0; counter < 20; counter++) {
python_indents[counter] = spaces;
spaces += " ";
}
var defaultToggleTypeHandlers = {
boolean: ["True", "False"],
compop: ["<", ">", "<=", ">=", "==", "!="],
mathop: ["+", "-", "*", "/"],
boolop: ["and", "or"],
range: function($item) {
var min = parseFloat($item.data("min") || "0", 10),
max = parseFloat($item.data("max") || "10", 10),
step = parseFloat($item.data("step") || "1", 10),
opts = [],
curr = min;
while (curr <= max) {
opts.push("" + curr);
curr += step;
}
return opts;
}
};
var addToggleableElements = function(widget) {
// toggleable elements are only enabled for unit tests
if (!widget.options.unittests) { return; }
var handlers = $.extend(defaultToggleTypeHandlers, widget.options.toggleTypeHandlers),
context = $("#" + widget.options.sortableId + ", #" + widget.options.trashId);
$(".jsparson-toggle", context).each(function(index, item) {
var type = $(item).data("type");
if (!type) { return; }
var handler = handlers[type],
jspOptions;
if ($.isFunction(handler)) {
jspOptions = handler($(item));
} else {
jspOptions = handler;
}
if (jspOptions && $.isArray(jspOptions)) {
$(item).attr("data-jsp-options", JSON.stringify(jspOptions));
}
});
context.on("click", ".jsparson-toggle", function() {
var $this = $(this),
curVal = $this.text(),
choices = $this.data("jsp-options");
$this.text(choices[(choices.indexOf(curVal) + 1)%choices.length]);
});
};
var ParsonsWidget = function(options) {
this.modified_lines = [];
this.extra_lines = [];
this.model_solution = [];
//To collect statistics, feedback should not be based on this
this.user_actions = [];
//State history for feedback purposes
this.state_path = [];
this.states = {};
var defaults = {
'incorrectSound': false,
'x_indent': 50,
'feedback_cb': false,
'first_error_only': true,
'max_wrong_lines': 10,
'trash_label': 'Drag from here',
'solution_label': 'Construct your solution here',
'lang': 'en',
'unittestId': 'unittest'
};
this.options = jQuery.extend({}, defaults, options);
this.feedback_exists = false;
this.id_prefix = options['sortableId'] + 'codeline';
if (translations.hasOwnProperty(this.options.lang)) {
this.translations = translations[this.options.lang];
} else {
this.translations = translations['en'];
}
this.FEEDBACK_STYLES = { 'correctPosition' : 'correctPosition',
'incorrectPosition' : 'incorrectPosition',
'correctIndent' : 'correctIndent',
'incorrectIndent' : 'incorrectIndent'};
};
//Public methods
ParsonsWidget.prototype.parseLine = function(spacePrefixedLine) {
return {
code: spacePrefixedLine.replace(trimRegexp, "$1").replace(/\\n/g,"\n"),
indent: spacePrefixedLine.length - spacePrefixedLine.replace(/^\s+/,"").length
};
};
ParsonsWidget.prototype.parseCode = function(lines, max_distractors) {
var distractors = [],
indented = [],
widgetData = [],
lineObject,
errors = [],
that = this;
$.each(lines, function(index, item) {
if (item.search(/#distractor\s*$/) >= 0) {
lineObject = {
code: item.replace(/#distractor\s*$/,"").replace(trimRegexp, "$1").replace(/\\n/,"\n"),
indent: -1,
distractor: true,
orig: index
};
if (lineObject.code.length > 0) {
distractors.push(lineObject);
}
} else {
lineObject = that.parseLine(item);
if (lineObject.code.length > 0) {
lineObject.distractor = false;
lineObject.orig = index;
indented.push(lineObject);
}
}
});
// Normalize indents and make sure indentation is valid
var normalized = this.normalizeIndents(indented);
$.each(normalized, function(index, item) {
if (item.indent < 0) {
errors.push(this.translations.no_matching(normalized.orig));
}
widgetData.push(item);
});
// Remove extra distractors
var permutation = this.getRandomPermutation(distractors.length);
var selected_distractors = [];
for (var i = 0; i < max_distractors; i++) {
selected_distractors.push(distractors[permutation[i]]);
widgetData.push(distractors[permutation[i]]);
}
return {
solution: $.extend(true, [], normalized),
distractors: $.extend(true, [], selected_distractors),
widgetInitial: $.extend(true, [], widgetData),
errors: errors};
};
ParsonsWidget.prototype.init = function(text) {
var initial_structures = this.parseCode(text.split("\n"), this.options.max_wrong_lines);
this.model_solution = initial_structures.solution;
this.extra_lines = initial_structures.distractors;
this.modified_lines = initial_structures.widgetInitial;
this.alternatives = {};
var that = this;
$.each(this.modified_lines, function(index, item) {
item.id = that.id_prefix + index;
item.indent = 0;
if (that.alternatives.hasOwnProperty(item.code)) {
that.alternatives[item.code].push(index);
} else {
that.alternatives[item.code] = [index];
}
});
};
ParsonsWidget.prototype.getHash = function(searchString) {
var ids = [];
var hash = [];
ids = $(searchString).sortable('toArray');
for (var i = 0; i < ids.length; i++) {
hash.push(ids[i].replace(this.id_prefix, "") + "_" + this.getLineById(ids[i]).indent);
}
//prefix with something to handle empty output situations
if (hash.length === 0) {
return "-";
} else {
return hash.join("-");
}
};
ParsonsWidget.prototype.solutionHash = function() {
return this.getHash("#ul-" + this.options.sortableId);
};
ParsonsWidget.prototype.trashHash = function() {
return this.getHash("#ul-" + this.options.trashId);
};
ParsonsWidget.prototype.whatWeDidPreviously = function() {
var hash = this.solutionHash();
var previously = this.states[hash];
if (!previously) { return undefined; }
var visits = _.filter(this.state_path, function(state) {
return state == hash;
}).length - 1;
var i, stepsToLast = 0, s,
outputStepTypes = ['removeOutput', 'addOutput', 'moveOutput'];
for (i = this.state_path.length - 2; i > 0; i--) {
s = this.states[this.state_path[i]];
if (s && outputStepTypes.indexOf(s.type) != -1) {
stepsToLast++;
}
if (hash === this.state_path[i]) { break; }
}
return $.extend(false, {'visits': visits, stepsToLast: stepsToLast}, previously);
};
ParsonsWidget.prototype.addLogEntry = function(entry) {
var state, previousState;
var logData = {
time: new Date(),
output: this.solutionHash(),
type: "action"
};
if (this.options.trashId) {
logData.input = this.trashHash();
}
if (entry.target) {
entry.target = entry.target.replace(this.id_prefix, "");
}
state = logData.output;
jQuery.extend(logData, entry);
this.user_actions.push(logData);
//Updating the state history
if(this.state_path.length > 0) {
previousState = this.state_path[this.state_path.length - 1];
this.states[previousState] = logData;
}
//Add new item to the state path only if new and previous states are not equal
if (this.state_path[this.state_path.length - 1] !== state) {
this.state_path.push(state);
// callback for reacting to actions
if ($.isFunction(this.options.action_cb)) {
this.options.action_cb.call(this, logData);
}
}
};
/**
* Update indentation of a line based on new coordinates
* leftDiff horizontal difference from (before and after drag) in px
***/
ParsonsWidget.prototype.updateIndent = function(leftDiff, id) {
var code_line = this.getLineById(id);
var new_indent = code_line.indent + Math.floor(leftDiff / this.options.x_indent);
new_indent = Math.max(0, new_indent);
code_line.indent = new_indent;
return new_indent;
};
/**
*
* @param id
* @return
*/
ParsonsWidget.prototype.getLineById = function(id) {
var index = -1;
for (var i = 0; i < this.modified_lines.length; i++) {
if (this.modified_lines[i].id == id) {
index = i;
break;
}
}
return this.modified_lines[index];
};
/** Does not use the current object - only the argument */
ParsonsWidget.prototype.normalizeIndents = function(lines) {
var normalized = [];
var new_line;
var match_indent = function(index) {
//return line index from the previous lines with matching indentation
for (var i = index-1; i >= 0; i--) {
if (lines[i].indent == lines[index].indent) {
return normalized[i].indent;
}
}
return -1;
};
for ( var i = 0; i < lines.length; i++ ) {
//create shallow copy from the line object
new_line = jQuery.extend({}, lines[i]);
if (i === 0) {
new_line.indent = 0;
if (lines[i].indent !== 0) {
new_line.indent = -1;
}
} else if (lines[i].indent == lines[i-1].indent) {
new_line.indent = normalized[i-1].indent;
} else if (lines[i].indent > lines[i-1].indent) {
new_line.indent = normalized[i-1].indent + 1;
} else {
// indentation can be -1 if no matching indentation exists, i.e. IndentationError in Python
new_line.indent = match_indent(i);
}
normalized[i] = new_line;
}
return normalized;
};
/**
* Retrieve the code lines based on what is in the DOM
*
* TODO(petri) refactor to UI
* */
ParsonsWidget.prototype.getModifiedCode = function(search_string) {
//ids of the the modified code
var lines_to_return = [],
that = this;
$(search_string).find("li").each(function(index, item) {
lines_to_return.push({id: $(item).attr("id"),
indent: parseInt($(item).css("margin-left"), 10)/that.options.x_indent});
});
return lines_to_return;
};
ParsonsWidget.prototype.hashToIDList = function(hash) {
var lines = [];
var lineValues;
var lineObject;
var h;
if (hash === "-" || hash === "" || hash === null) {
h = [];
} else {
h = hash.split("-");
}
var ids = [];
for (var i = 0; i < h.length; i++) {
lineValues = h[i].split("_");
ids.push(this.modified_lines[lineValues[0]].id);
}
return ids;
};
ParsonsWidget.prototype.updateIndentsFromHash = function(hash) {
var lines = [];
var lineValues;
var lineObject;
var h;
if (hash === "-" || hash === "" || hash === null) {
h = [];
} else {
h = hash.split("-");
}
var ids = [];
for (var i = 0; i < h.length; i++) {
lineValues = h[i].split("_");
this.modified_lines[lineValues[0]].indent = Number(lineValues[1]);
this.updateHTMLIndent(this.modified_lines[lineValues[0]].id);
}
return ids;
};
/**
* TODO(petri) refoctor to UI
*/
ParsonsWidget.prototype.displayError = function(message) {
if (this.options.incorrectSound && $.sound) {
$.sound.play(this.options.incorrectSound);
}
alert(message);
};
ParsonsWidget.prototype.colorFeedback = function(elemId) {
var student_code = this.normalizeIndents(this.getModifiedCode("#ul-" + elemId));
var lines_to_check = Math.min(student_code.length, this.model_solution.length);
var errors = [], log_errors = [];
var incorrectLines = [], lines = [];
var id, line, i;
var wrong_order = false;
//remove distractors from lines and add all those to the set of misplaced lines
for (i=0; i<student_code.length; i++) {
id = parseInt(student_code[i].id.replace(this.id_prefix, ""), 10);
line = this.getLineById(this.id_prefix + id);
if (line.distractor) {
incorrectLines.push(id);
wrong_order = true;
$("#" + this.id_prefix + id).addClass("incorrectPosition");
} else {
lines.push(id);
}
}
var inv = LIS.best_lise_inverse(lines);
var that = this;
_.each(inv, function(itemId) {
$("#" + that.id_prefix + itemId).addClass("incorrectPosition");
incorrectLines.push(itemId);
});
if (inv.length > 0 || errors.length > 0) {
wrong_order = true;
log_errors.push({type: "incorrectPosition", lines: incorrectLines});
}
if (wrong_order) {
errors.push(this.translations.order());
}
// Always show this feedback
if (this.model_solution.length < student_code.length) {
//$("#ul-" + elemId).addClass("incorrect");
//errors.push("Too many lines in your solution.");
log_errors.push({type: "tooManyLines", lines: student_code.length});
} else if (this.model_solution.length > student_code.length){
$("#ul-" + elemId).addClass("incorrect");
errors.push(this.translations.lines_missing());
log_errors.push({type: "tooFewLines", lines: student_code.length});
}
if (errors.length === 0) { // check indent if no other errors
for (i = 0; i < lines_to_check; i++) {
var code_line = student_code[i];
var model_line = this.model_solution[i];
if (code_line.indent !== model_line.indent &&
((!this.options.first_error_only) || errors.length === 0)) {
$("#" + code_line.id).addClass("incorrectIndent");
errors.push(this.translations.block_structure(i+1));
log_errors.push({type: "incorrectIndent", line: (i+1)});
}
if (code_line.code == model_line.code &&
code_line.indent == model_line.indent &&
errors.length === 0) {
$("#" + code_line.id).addClass("correctPosition");
}
}
}
if (errors.length === 0) {
$("#ul-" + elemId).addClass("correct");
}
return {errors: errors, log_errors: log_errors};
};
ParsonsWidget.prototype.unittest = function(unittests) {
var that = this,
feedback = "",
log_errors = [],
all_passed = true;
$.each(unittests, function(index, testdata) {
var $lines = $("#sortable li");
var student_code = that.normalizeIndents(that.getModifiedCode("#ul-sortable"));
var executableCode = "";
$.each(student_code, function(index, item) {
// split codeblocks on br elements
var lines = $("#" + item.id).html().split(/<br\s*\/?>/);
// go through all the lines
for (var i = 0; i < lines.length; i++) {
// add indents and get the text for the line (to remove the syntax highlight html elements)
executableCode += python_indents[item.indent] + $("<span>" + lines[i] + "</span>").text() + "\n";
}
});
executableCode += testdata.code;
var res = python_exec(executableCode, [testdata.variable]);
var testcaseFeedback = "",
success = true,
log_entry = {'code': testdata.code, 'msg': testdata.message},
expected_value,
actual_value;
if ("_error" in res) {
testcaseFeedback += that.translations.unittest_error(res._error);
success = false;
log_entry.type = "error";
log_entry.errormsg = res._error;
} else {
if (testdata.variable === "_output") { // checking output of the program
expected_value = testdata.expected;
actual_value = res._output;
testcaseFeedback += that.translations.unittest_output_assertion(expected_value, actual_value);
} else {
expected_value = formatVariableValue(testdata.expected);
actual_value = formatVariableValue(res.variables[testdata.variable]);
testcaseFeedback += that.translations.unittest_assertion(expected_value, actual_value);
}
log_entry.type = "assertion";
log_entry.variable = testdata.variable;
log_entry.expected = expected_value;
log_entry.actual = actual_value;
if (actual_value != expected_value) { // should we do a strict test??
success = false;
}
}
all_passed = all_passed && success;
log_entry.success = success;
log_errors.push(log_entry);
feedback += "<div class='testcase " + (success?"correct":"incorrect") +
"'><span class='msg'>" + testdata.message + "</span><br>" +
testcaseFeedback + "</div>";
});
if (all_passed) {
$("#ul-" + this.options.sortableId).addClass("correct");
}
return { errors: feedback, "log_errors": log_errors, success: all_passed };
};
/**
* @return
* TODO(petri): Separate UI from here
*/
ParsonsWidget.prototype.getFeedback = function() {
var fb;
this.feedback_exists = true;
if (typeof(this.options.unittests) !== "undefined") { /// unittests are specified
fb = this.unittest(this.options.unittests);
this.addLogEntry({type: "feedback", errors: fb.log_errors});
return { feedback: fb.errors, success: fb.success };
} else { // "traditional" parson feedback
fb = this.colorFeedback(this.options.sortableId);
if (this.options.feedback_cb) {
this.options.feedback_cb(fb); //TODO(petri): what is needed?
}
this.addLogEntry({type: "feedback", errors: fb.log_errors});
return fb.errors;
}
};
ParsonsWidget.prototype.clearFeedback = function() {
if (this.feedback_exists) {
$("#ul-" + this.options.sortableId).removeClass("incorrect correct");
var li_elements = $("#ul-" + this.options.sortableId + " li");
$.each(this.FEEDBACK_STYLES, function(index, value) {
li_elements.removeClass(value);
});
}
this.feedback_exists = false;
};
ParsonsWidget.prototype.getRandomPermutation = function(n) {
var permutation = [];
var i;
for (i = 0; i < n; i++) {
permutation.push(i);
}
var swap1, swap2, tmp;
for (i = 0; i < n; i++) {
swap1 = Math.floor(Math.random() * n);
swap2 = Math.floor(Math.random() * n);
tmp = permutation[swap1];
permutation[swap1] = permutation[swap2];
permutation[swap2] = tmp;
}
return permutation;
};
ParsonsWidget.prototype.shuffleLines = function() {
var permutation = this.getRandomPermutation(this.modified_lines.length);
var idlist = [];
for(var i in permutation) {
idlist.push(this.modified_lines[permutation[i]].id);
}
if (this.options.trashId) {
this.createHTMLFromLists([],idlist);
} else {
this.createHTMLFromLists(idlist,[]);
}
addToggleableElements(this);
};
ParsonsWidget.prototype.createHTMLFromHashes = function(solutionHash, trashHash) {
var solution = this.hashToIDList(solutionHash);
var trash = this.hashToIDList(trashHash);
this.createHTMLFromLists(solution,trash);
this.updateIndentsFromHash(solutionHash);
};
ParsonsWidget.prototype.updateHTMLIndent = function(codelineID) {
var line = this.getLineById(codelineID);
$('#' + codelineID).css("margin-left", this.options.x_indent * line.indent + "px");
};
ParsonsWidget.prototype.codeLineToHTML = function(codeline) {
return '<li id="' + codeline.id + '" class="prettyprint lang-py">' + codeline.code + '<\/li>';
};
ParsonsWidget.prototype.codeLinesToHTML = function(codelineIDs, destinationID) {
var lineHTML = [];
for(var id in codelineIDs) {
var line = this.getLineById(codelineIDs[id]);
lineHTML.push(this.codeLineToHTML(line));
}
return '<ul id="ul-' + destinationID + '">'+lineHTML.join('')+'</ul>';
};
/** modifies the DOM by inserting exercise elements into it */
ParsonsWidget.prototype.createHTMLFromLists = function(solutionIDs, trashIDs) {
var html;
if (this.options.trashId) {
html = (this.options.trash_label?'<p>'+this.options.trash_label+'</p>':'') +
this.codeLinesToHTML(trashIDs, this.options.trashId);
$("#" + this.options.trashId).html(html);
html = (this.options.solution_label?'<p>'+this.options.solution_label+'</p>':'') +
this.codeLinesToHTML(solutionIDs, this.options.sortableId);
$("#" + this.options.sortableId).html(html);
} else {
html = this.codeLinesToHTML(solutionIDs, this.options.sortableId);
$("#" + this.options.sortableId).html(html);
}
if (window.prettyPrint && (typeof(this.options.prettyPrint) === "undefined" || this.options.prettyPrint)) {
prettyPrint();
}
var that = this;
var sortable = $("#ul-" + this.options.sortableId).sortable(
{
start : function() { that.clearFeedback(); },
stop : function(event, ui) {
if ($(event.target)[0] != ui.item.parent()[0]) {
return;
}
that.updateIndent(ui.position.left - ui.item.parent().offset().left,
ui.item[0].id);
that.updateHTMLIndent(ui.item[0].id);
that.addLogEntry({type: "moveOutput", target: ui.item[0].id}, true);
},
receive : function(event, ui) {
var ind = that.updateIndent(ui.position.left - ui.item.parent().offset().left,
ui.item[0].id);
that.updateHTMLIndent(ui.item[0].id);
that.addLogEntry({type: "addOutput", target: ui.item[0].id}, true);
},
grid : [that.options.x_indent, 1 ]
});
sortable.addClass("output");
if (this.options.trashId) {
var trash = $("#ul-" + this.options.trashId).sortable(
{
connectWith: sortable,
start: function() { that.clearFeedback(); },
receive: function(event, ui) {
that.getLineById(ui.item[0].id).indent = 0;
that.updateHTMLIndent(ui.item[0].id);
that.addLogEntry({type: "removeOutput", target: ui.item[0].id}, true);
},
stop: function(event, ui) {
if ($(event.target)[0] != ui.item.parent()[0]) {
// line moved to output and logged there
return;
}
that.addLogEntry({type: "moveInput", target: ui.item[0].id}, true);
}
});
sortable.sortable('option', 'connectWith', trash);
}
this.addLogEntry({type: 'init', time: new Date(), bindings: this.modified_lines});
};
window['ParsonsWidget'] = ParsonsWidget;
}
// allows _ and $ to be modified with noconflict without changing the globals
// that parsons uses
)($,_);

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,749 @@
(function(){var COMPILED=!0,goog=goog||{};goog.global=this;goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c=c[d]?c[d]:c[d]={}:c[d]=b};goog.define=function(a,b){var c=b;COMPILED||goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,a)&&(c=goog.global.CLOSURE_DEFINES[a]);goog.exportPath_(a,c)};goog.DEBUG=!1;goog.LOCALE="en";goog.TRUSTED_SITE=!0;
goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(".")))&&!goog.getObjectByName(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||"",Error("Importing test-only code into non-debug environment"+a?": "+a:".");};
COMPILED||(goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},goog.implicitNamespaces_={});goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d};goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};
goog.addDependency=function(a,b,c){if(goog.DEPENDENCIES_ENABLED){var d;a=a.replace(/\\/g,"/");for(var e=goog.dependencies_,f=0;d=b[f];f++)e.nameToPath[d]=a,a in e.pathToNames||(e.pathToNames[a]={}),e.pathToNames[a][d]=!0;for(d=0;b=c[d];d++)a in e.requires||(e.requires[a]={}),e.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0;
goog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=!0;goog.writeScripts_();return}}a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a,b){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");};
goog.addSingletonGetter=function(a){a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;
goog.DEPENDENCIES_ENABLED&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return"undefined"!=typeof a&&"write"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("script"),b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?"),d=-1==d?c.length:
d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function(a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){if(goog.inHtmlDocument_()){var b=goog.global.document;if("complete"==b.readyState){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}b.write('<script type="text/javascript" src="'+a+'">\x3c/script>');
return!0}return!1},goog.writeScripts_=function(){function a(e){if(!(e in d.written)){if(!(e in d.visited)&&(d.visited[e]=!0,e in d.requires))for(var g in d.requires[e])if(!goog.isProvided_(g))if(g in d.nameToPath)a(d.nameToPath[g]);else throw Error("Undefined nameToPath for "+g);e in c||(c[e]=!0,b.push(e))}}var b=[],c={},d=goog.dependencies_,e;for(e in goog.included_)d.written[e]||a(e);for(e=0;e<b.length;e++)if(b[e])goog.importScript_(goog.basePath+b[e]);else throw Error("Undefined script input");
},goog.getPathFromDeps_=function(a){return a in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js"));
goog.typeOf=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b};goog.isDef=function(a){return void 0!==a};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return"array"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return"array"==b||"object"==b&&"number"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&"function"==typeof a.getFullYear};goog.isString=function(a){return"string"==typeof a};
goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};goog.isFunction=function(a){return"function"==goog.typeOf(a)};goog.isObject=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.removeUid=function(a){"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};
goog.UID_PROPERTY_="closure_uid_"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(a.clone)return a.clone();var b="array"==b?[]:{},c;for(c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};
goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}};goog.bind=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};
goog.partial=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};
goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval)if(null==goog.evalWorksForGlobals_&&(goog.global.eval("var _et_ = 1;"),"undefined"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1),goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.defer=!1;c.appendChild(b.createTextNode(a));b.body.appendChild(c);
b.body.removeChild(c)}else throw Error("goog.globalEval not available");};goog.evalWorksForGlobals_=null;goog.getCssName=function(a,b){var c=function(a){return goog.cssNameMapping_[a]||a},d=function(a){a=a.split("-");for(var b=[],d=0;d<a.length;d++)b.push(c(a[d]));return b.join("-")},d=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?c:d:function(a){return a};return b?a+"-"+d(b):d(a)};goog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};
!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,b){var c=b||{},d;for(d in c){var e=(""+c[d]).replace(/\$/g,"$$$$");a=a.replace(RegExp("\\{\\$"+d+"\\}","gi"),e)}return a};goog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};goog.exportProperty=function(a,b,c){a[b]=c};
goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};
goog.base=function(a,b,c){var d=arguments.callee.caller;if(goog.DEBUG&&!d)throw Error("arguments.caller not defined. goog.base() expects not to be running in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(d.superClass_)return d.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var e=Array.prototype.slice.call(arguments,2),f=!1,g=a.constructor;g;g=g.superClass_&&g.superClass_.constructor)if(g.prototype[b]===d)f=!0;else if(f)return g.prototype[b].apply(a,
e);if(a[b]===d)return a.constructor.prototype[b].apply(a,e);throw Error("goog.base called from a method of one name to a method of a different name");};goog.scope=function(a){a.call(goog.global)};goog.string={};goog.string.Unicode={NBSP:"\u00a0"};goog.string.startsWith=function(a,b){return 0==a.lastIndexOf(b,0)};goog.string.endsWith=function(a,b){var c=a.length-b.length;return 0<=c&&a.indexOf(b,c)==c};goog.string.caseInsensitiveStartsWith=function(a,b){return 0==goog.string.caseInsensitiveCompare(b,a.substr(0,b.length))};goog.string.caseInsensitiveEndsWith=function(a,b){return 0==goog.string.caseInsensitiveCompare(b,a.substr(a.length-b.length,b.length))};
goog.string.caseInsensitiveEquals=function(a,b){return a.toLowerCase()==b.toLowerCase()};goog.string.subs=function(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")};goog.string.collapseWhitespace=function(a){return a.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")};goog.string.isEmpty=function(a){return/^[\s\xa0]*$/.test(a)};goog.string.isEmptySafe=function(a){return goog.string.isEmpty(goog.string.makeSafe(a))};
goog.string.isBreakingWhitespace=function(a){return!/[^\t\n\r ]/.test(a)};goog.string.isAlpha=function(a){return!/[^a-zA-Z]/.test(a)};goog.string.isNumeric=function(a){return!/[^0-9]/.test(a)};goog.string.isAlphaNumeric=function(a){return!/[^a-zA-Z0-9]/.test(a)};goog.string.isSpace=function(a){return" "==a};goog.string.isUnicodeChar=function(a){return 1==a.length&&" "<=a&&"~">=a||"\u0080"<=a&&"\ufffd">=a};goog.string.stripNewlines=function(a){return a.replace(/(\r\n|\r|\n)+/g," ")};
goog.string.canonicalizeNewlines=function(a){return a.replace(/(\r\n|\r|\n)/g,"\n")};goog.string.normalizeWhitespace=function(a){return a.replace(/\xa0|\s/g," ")};goog.string.normalizeSpaces=function(a){return a.replace(/\xa0|[ \t]+/g," ")};goog.string.collapseBreakingSpaces=function(a){return a.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")};goog.string.trim=function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};
goog.string.trimLeft=function(a){return a.replace(/^[\s\xa0]+/,"")};goog.string.trimRight=function(a){return a.replace(/[\s\xa0]+$/,"")};goog.string.caseInsensitiveCompare=function(a,b){var c=String(a).toLowerCase(),d=String(b).toLowerCase();return c<d?-1:c==d?0:1};goog.string.numerateCompareRegExp_=/(\.\d+)|(\d+)|(\D+)/g;
goog.string.numerateCompare=function(a,b){if(a==b)return 0;if(!a)return-1;if(!b)return 1;for(var c=a.toLowerCase().match(goog.string.numerateCompareRegExp_),d=b.toLowerCase().match(goog.string.numerateCompareRegExp_),e=Math.min(c.length,d.length),f=0;f<e;f++){var g=c[f],h=d[f];if(g!=h)return c=parseInt(g,10),!isNaN(c)&&(d=parseInt(h,10),!isNaN(d)&&c-d)?c-d:g<h?-1:1}return c.length!=d.length?c.length-d.length:a<b?-1:1};goog.string.urlEncode=function(a){return encodeURIComponent(String(a))};
goog.string.urlDecode=function(a){return decodeURIComponent(a.replace(/\+/g," "))};goog.string.newLineToBr=function(a,b){return a.replace(/(\r\n|\r|\n)/g,b?"<br />":"<br>")};
goog.string.htmlEscape=function(a,b){if(b)return a.replace(goog.string.amperRe_,"&amp;").replace(goog.string.ltRe_,"&lt;").replace(goog.string.gtRe_,"&gt;").replace(goog.string.quotRe_,"&quot;");if(!goog.string.allRe_.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(goog.string.amperRe_,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(goog.string.ltRe_,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(goog.string.gtRe_,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(goog.string.quotRe_,"&quot;"));return a};
goog.string.amperRe_=/&/g;goog.string.ltRe_=/</g;goog.string.gtRe_=/>/g;goog.string.quotRe_=/\"/g;goog.string.allRe_=/[&<>\"]/;goog.string.unescapeEntities=function(a){return goog.string.contains(a,"&")?"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(a):goog.string.unescapePureXmlEntities_(a):a};
goog.string.unescapeEntitiesUsingDom_=function(a){var b={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"'},c=document.createElement("div");return a.replace(goog.string.HTML_ENTITY_PATTERN_,function(a,e){var f=b[a];if(f)return f;if("#"==e.charAt(0)){var g=Number("0"+e.substr(1));isNaN(g)||(f=String.fromCharCode(g))}f||(c.innerHTML=a+" ",f=c.firstChild.nodeValue.slice(0,-1));return b[a]=f})};
goog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(a,c){switch(c){case "amp":return"&";case "lt":return"<";case "gt":return">";case "quot":return'"';default:if("#"==c.charAt(0)){var d=Number("0"+c.substr(1));if(!isNaN(d))return String.fromCharCode(d)}return a}})};goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g;goog.string.whitespaceEscape=function(a,b){return goog.string.newLineToBr(a.replace(/ /g," &#160;"),b)};
goog.string.stripQuotes=function(a,b){for(var c=b.length,d=0;d<c;d++){var e=1==c?b:b.charAt(d);if(a.charAt(0)==e&&a.charAt(a.length-1)==e)return a.substring(1,a.length-1)}return a};goog.string.truncate=function(a,b,c){c&&(a=goog.string.unescapeEntities(a));a.length>b&&(a=a.substring(0,b-3)+"...");c&&(a=goog.string.htmlEscape(a));return a};
goog.string.truncateMiddle=function(a,b,c,d){c&&(a=goog.string.unescapeEntities(a));if(d&&a.length>b){d>b&&(d=b);var e=a.length-d;a=a.substring(0,b-d)+"..."+a.substring(e)}else a.length>b&&(d=Math.floor(b/2),e=a.length-d,a=a.substring(0,d+b%2)+"..."+a.substring(e));c&&(a=goog.string.htmlEscape(a));return a};goog.string.specialEscapeChars_={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\"};goog.string.jsEscapeCache_={"'":"\\'"};
goog.string.quote=function(a){a=String(a);if(a.quote)return a.quote();for(var b=['"'],c=0;c<a.length;c++){var d=a.charAt(c),e=d.charCodeAt(0);b[c+1]=goog.string.specialEscapeChars_[d]||(31<e&&127>e?d:goog.string.escapeChar(d))}b.push('"');return b.join("")};goog.string.escapeString=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=goog.string.escapeChar(a.charAt(c));return b.join("")};
goog.string.escapeChar=function(a){if(a in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[a];if(a in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[a]=goog.string.specialEscapeChars_[a];var b=a,c=a.charCodeAt(0);if(31<c&&127>c)b=a;else{if(256>c){if(b="\\x",16>c||256<c)b+="0"}else b="\\u",4096>c&&(b+="0");b+=c.toString(16).toUpperCase()}return goog.string.jsEscapeCache_[a]=b};goog.string.toMap=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=!0;return b};
goog.string.contains=function(a,b){return-1!=a.indexOf(b)};goog.string.countOf=function(a,b){return a&&b?a.split(b).length-1:0};goog.string.removeAt=function(a,b,c){var d=a;0<=b&&(b<a.length&&0<c)&&(d=a.substr(0,b)+a.substr(b+c,a.length-b-c));return d};goog.string.remove=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"");return a.replace(c,"")};goog.string.removeAll=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"g");return a.replace(c,"")};
goog.string.regExpEscape=function(a){return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")};goog.string.repeat=function(a,b){return Array(b+1).join(a)};goog.string.padNumber=function(a,b,c){a=goog.isDef(c)?a.toFixed(c):String(a);c=a.indexOf(".");-1==c&&(c=a.length);return goog.string.repeat("0",Math.max(0,b-c))+a};goog.string.makeSafe=function(a){return null==a?"":String(a)};goog.string.buildString=function(a){return Array.prototype.join.call(arguments,"")};
goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)};
goog.string.compareVersions=function(a,b){for(var c=0,d=goog.string.trim(String(a)).split("."),e=goog.string.trim(String(b)).split("."),f=Math.max(d.length,e.length),g=0;0==c&&g<f;g++){var h=d[g]||"",k=e[g]||"",l=RegExp("(\\d*)(\\D*)","g"),m=RegExp("(\\d*)(\\D*)","g");do{var n=l.exec(h)||["","",""],p=m.exec(k)||["","",""];if(0==n[0].length&&0==p[0].length)break;var c=0==n[1].length?0:parseInt(n[1],10),q=0==p[1].length?0:parseInt(p[1],10),c=goog.string.compareElements_(c,q)||goog.string.compareElements_(0==
n[2].length,0==p[2].length)||goog.string.compareElements_(n[2],p[2])}while(0==c)}return c};goog.string.compareElements_=function(a,b){return a<b?-1:a>b?1:0};goog.string.HASHCODE_MAX_=4294967296;goog.string.hashCode=function(a){for(var b=0,c=0;c<a.length;++c)b=31*b+a.charCodeAt(c),b%=goog.string.HASHCODE_MAX_;return b};goog.string.uniqueStringCounter_=2147483648*Math.random()|0;goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++};
goog.string.toNumber=function(a){var b=Number(a);return 0==b&&goog.string.isEmpty(a)?NaN:b};goog.string.isLowerCamelCase=function(a){return/^[a-z]+([A-Z][a-z]*)*$/.test(a)};goog.string.isUpperCamelCase=function(a){return/^([A-Z][a-z]*)+$/.test(a)};goog.string.toCamelCase=function(a){return String(a).replace(/\-([a-z])/g,function(a,c){return c.toUpperCase()})};goog.string.toSelectorCase=function(a){return String(a).replace(/([A-Z])/g,"-$1").toLowerCase()};
goog.string.toTitleCase=function(a,b){var c=goog.isString(b)?goog.string.regExpEscape(b):"\\s";return a.replace(RegExp("(^"+(c?"|["+c+"]+":"")+")([a-z])","g"),function(a,b,c){return b+c.toUpperCase()})};goog.string.parseInt=function(a){isFinite(a)&&(a=String(a));return goog.isString(a)?/^\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN};goog.string.splitLimit=function(a,b,c){a=a.split(b);for(var d=[];0<c&&a.length;)d.push(a.shift()),c--;a.length&&d.push(a.join(b));return d};goog.debug={};goog.debug.Error=function(a){Error.captureStackTrace?Error.captureStackTrace(this,goog.debug.Error):this.stack=Error().stack||"";a&&(this.message=String(a))};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name="CustomError";goog.asserts={};goog.asserts.ENABLE_ASSERTS=goog.DEBUG;goog.asserts.AssertionError=function(a,b){b.unshift(a);goog.debug.Error.call(this,goog.string.subs.apply(null,b));b.shift();this.messagePattern=a};goog.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name="AssertionError";goog.asserts.doAssertFailure_=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new goog.asserts.AssertionError(""+e,f||[]);};
goog.asserts.assert=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!a&&goog.asserts.doAssertFailure_("",null,b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.fail=function(a,b){if(goog.asserts.ENABLE_ASSERTS)throw new goog.asserts.AssertionError("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};
goog.asserts.assertNumber=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(a)&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertString=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isString(a)&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertFunction=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(a)&&goog.asserts.doAssertFailure_("Expected function but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertObject=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isObject(a)&&goog.asserts.doAssertFailure_("Expected object but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertArray=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isArray(a)&&goog.asserts.doAssertFailure_("Expected array but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertBoolean=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(a)&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertInstanceof=function(a,b,c,d){!goog.asserts.ENABLE_ASSERTS||a instanceof b||goog.asserts.doAssertFailure_("instanceof check failed.",null,c,Array.prototype.slice.call(arguments,3));return a};goog.asserts.assertObjectPrototypeIsIntact=function(){for(var a in Object.prototype)goog.asserts.fail(a+" should not be enumerable in Object.prototype.")};var Sk=Sk||{};
Sk.configure=function(a){Sk.output=a.output||Sk.output;goog.asserts.assert("function"===typeof Sk.output);Sk.debugout=a.debugout||Sk.debugout;goog.asserts.assert("function"===typeof Sk.debugout);Sk.read=a.read||Sk.read;goog.asserts.assert("function"===typeof Sk.read);Sk.timeoutMsg=a.timeoutMsg||Sk.timeoutMsg;goog.asserts.assert("function"===typeof Sk.timeoutMsg);goog.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg);Sk.sysargv=a.sysargv||Sk.sysargv;goog.asserts.assert(goog.isArrayLike(Sk.sysargv));Sk.python3=
a.python3||Sk.python3;goog.asserts.assert("boolean"===typeof Sk.python3);Sk.inputfun=a.inputfun||Sk.inputfun;goog.asserts.assert("function"===typeof Sk.inputfun);Sk.throwSystemExit=a.systemexit||!1;goog.asserts.assert("boolean"===typeof Sk.throwSystemExit);a.syspath&&(Sk.syspath=a.syspath,goog.asserts.assert(goog.isArrayLike(Sk.syspath)),Sk.realsyspath=void 0,Sk.sysmodules=new Sk.builtin.dict([]));Sk.misceval.softspace_=!1};goog.exportSymbol("Sk.configure",Sk.configure);Sk.timeoutMsg=function(){return"Program exceeded run time limit."};
goog.exportSymbol("Sk.timeoutMsg",Sk.timeoutMsg);Sk.output=function(a){};Sk.read=function(a){throw"Sk.read has not been implemented";};Sk.sysargv=[];Sk.getSysArgv=function(){return Sk.sysargv};goog.exportSymbol("Sk.getSysArgv",Sk.getSysArgv);Sk.syspath=[];Sk.inBrowser=void 0!==goog.global.document;Sk.debugout=function(a){};
(function(){void 0!==goog.global.write?Sk.output=goog.global.write:void 0!==goog.global.console&&void 0!==goog.global.console.log?Sk.output=function(a){goog.global.console.log(a)}:void 0!==goog.global.print&&(Sk.output=goog.global.print);void 0!==goog.global.print&&(Sk.debugout=goog.global.print)})();Sk.inBrowser||(goog.global.CLOSURE_IMPORT_SCRIPT=function(a){goog.global.eval(goog.global.read("support/closure-library/closure/goog/"+a));return!0});Sk.python3=!1;Sk.inputfun=function(a){return prompt(a)};
goog.exportSymbol("Sk.python3",Sk.python3);goog.exportSymbol("Sk.inputfun",Sk.inputfun);Sk.builtin={};
Sk.builtin.range=function(a,b,c){var d=[],e;Sk.builtin.pyCheckArgs("range",arguments,1,3);Sk.builtin.pyCheckType("start","integer",Sk.builtin.checkInt(a));void 0!==b&&Sk.builtin.pyCheckType("stop","integer",Sk.builtin.checkInt(b));void 0!==c&&Sk.builtin.pyCheckType("step","integer",Sk.builtin.checkInt(c));a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);c=Sk.builtin.asnum$(c);void 0===b&&void 0===c?(b=a,a=0,c=1):void 0===c&&(c=1);if(0===c)throw new Sk.builtin.ValueError("range() step argument must not be zero");if(0<
c)for(e=a;e<b;e+=c)d.push(new Sk.builtin.nmber(e,Sk.builtin.nmber.int$));else for(e=a;e>b;e+=c)d.push(new Sk.builtin.nmber(e,Sk.builtin.nmber.int$));return new Sk.builtin.list(d)};
Sk.builtin.asnum$=function(a){return void 0===a||null===a?a:a.constructor===Sk.builtin.none?null:a.constructor===Sk.builtin.bool?a.v?1:0:"number"===typeof a?a:"string"===typeof a?a:a.constructor===Sk.builtin.nmber?a.v:a.constructor===Sk.builtin.lng?a.cantBeInt()?a.str$(10,!0):a.toInt$():a.constructor===Sk.builtin.biginteger?0<a.trueCompare(new Sk.builtin.biginteger(Sk.builtin.lng.threshold$))||0>a.trueCompare(new Sk.builtin.biginteger(-Sk.builtin.lng.threshold$))?a.toString():a.intValue():a};
goog.exportSymbol("Sk.builtin.asnum$",Sk.builtin.asnum$);Sk.builtin.assk$=function(a,b){return new Sk.builtin.nmber(a,b)};goog.exportSymbol("Sk.builtin.assk$",Sk.builtin.assk$);
Sk.builtin.asnum$nofloat=function(a){if(void 0===a||null===a)return a;if(a.constructor===Sk.builtin.none)return null;if(a.constructor===Sk.builtin.bool)return a.v?1:0;"number"===typeof a&&(a=a.toString());a.constructor===Sk.builtin.nmber&&(a=a.v.toString());a.constructor===Sk.builtin.lng&&(a=a.str$(10,!0));a.constructor===Sk.builtin.biginteger&&(a=a.toString());if(0>a.indexOf(".")&&0>a.indexOf("e")&&0>a.indexOf("E"))return a;var b=0,c;0<=a.indexOf("e")?(c=a.substr(0,a.indexOf("e")),b=a.substr(a.indexOf("e")+
1)):0<=a.indexOf("E")?(c=a.substr(0,a.indexOf("e")),b=a.substr(a.indexOf("E")+1)):c=a;b=parseInt(b,10);a=c.indexOf(".");if(0>a){if(0<=b){for(;0<b--;)c+="0";return c}return c.length>-b?c.substr(0,c.length+b):0}c=0==a?c.substr(1):a<c.length?c.substr(0,a)+c.substr(a+1):c.substr(0,a);for(a+=b;a>c.length;)c+="0";return c=0>=a?0:c.substr(0,a)};goog.exportSymbol("Sk.builtin.asnum$nofloat",Sk.builtin.asnum$nofloat);
Sk.builtin.round=function(a,b){var c;Sk.builtin.pyCheckArgs("round",arguments,1,2);if(!Sk.builtin.checkNumber(a))throw new Sk.builtin.TypeError("a float is required");if(void 0!==b&&!Sk.misceval.isIndex(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");void 0===b&&(b=0);a=Sk.builtin.asnum$(a);b=Sk.misceval.asIndex(b);c=Math.pow(10,b);c=Math.round(a*c)/c;return new Sk.builtin.nmber(c,Sk.builtin.nmber.float$)};
Sk.builtin.len=function(a){Sk.builtin.pyCheckArgs("len",arguments,1,1);if(a.sq$length)return new Sk.builtin.nmber(a.sq$length(),Sk.builtin.nmber.int$);if(a.mp$length)return new Sk.builtin.nmber(a.mp$length(),Sk.builtin.nmber.int$);if(a.tp$length)return new Sk.builtin.nmber(a.tp$length(),Sk.builtin.nmber.int$);throw new Sk.builtin.TypeError("object of type '"+Sk.abstr.typeName(a)+"' has no len()");};
Sk.builtin.min=function(){Sk.builtin.pyCheckArgs("min",arguments,1);arguments=Sk.misceval.arrayFromArguments(arguments);for(var a=arguments[0],b=1;b<arguments.length;++b)Sk.misceval.richCompareBool(arguments[b],a,"Lt")&&(a=arguments[b]);return a};Sk.builtin.max=function(){Sk.builtin.pyCheckArgs("max",arguments,1);arguments=Sk.misceval.arrayFromArguments(arguments);for(var a=arguments[0],b=1;b<arguments.length;++b)Sk.misceval.richCompareBool(arguments[b],a,"Gt")&&(a=arguments[b]);return a};
Sk.builtin.any=function(a){var b,c;Sk.builtin.pyCheckArgs("any",arguments,1);if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");b=a.tp$iter();for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(Sk.misceval.isTrue(c))return!0;return!1};
Sk.builtin.all=function(a){var b,c;Sk.builtin.pyCheckArgs("all",arguments,1);if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");b=a.tp$iter();for(c=b.tp$iternext();void 0!==c;c=b.tp$iternext())if(!Sk.misceval.isTrue(c))return!1;return!0};
Sk.builtin.sum=function(a,b){var c,d,e,f;Sk.builtin.pyCheckArgs("sum",arguments,1,2);Sk.builtin.pyCheckType("iter","iterable",Sk.builtin.checkIterable(a));if(void 0!==b&&Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("sum() can't sum strings [use ''.join(seq) instead]");c=void 0===b?new Sk.builtin.nmber(0,Sk.builtin.nmber.int$):b;d=a.tp$iter();for(e=d.tp$iternext();void 0!==e;e=d.tp$iternext())if(e.skType===Sk.builtin.nmber.float$?(f=!0,c.skType!==Sk.builtin.nmber.float$&&(c=new Sk.builtin.nmber(Sk.builtin.asnum$(c),
Sk.builtin.nmber.float$))):e instanceof Sk.builtin.lng&&(f||c instanceof Sk.builtin.lng||(c=new Sk.builtin.lng(c))),void 0!==c.nb$add(e))c=c.nb$add(e);else throw new Sk.builtin.TypeError("unsupported operand type(s) for +: '"+Sk.abstr.typeName(c)+"' and '"+Sk.abstr.typeName(e)+"'");return c};
Sk.builtin.zip=function(){if(0===arguments.length)return new Sk.builtin.list([]);for(var a=[],b=0;b<arguments.length;b++)if(arguments[b].tp$iter)a.push(arguments[b].tp$iter());else throw"TypeError: argument "+b+" must support iteration";for(var c=[],d=!1;!d;){for(var e=[],b=0;b<arguments.length;b++){var f=a[b].tp$iternext();if(void 0===f){d=!0;break}e.push(f)}d||c.push(new Sk.builtin.tuple(e))}return new Sk.builtin.list(c)};
Sk.builtin.abs=function(a){Sk.builtin.pyCheckArgs("abs",arguments,1,1);Sk.builtin.pyCheckType("x","number",Sk.builtin.checkNumber(a));return new Sk.builtin.nmber(Math.abs(Sk.builtin.asnum$(a)),a.skType)};
Sk.builtin.ord=function(a){Sk.builtin.pyCheckArgs("ord",arguments,1,1);if(!Sk.builtin.checkString(a))throw new Sk.builtin.TypeError("ord() expected a string of length 1, but "+Sk.abstr.typeName(a)+" found");if(1!==a.v.length)throw new Sk.builtin.TypeError("ord() expected a character, but string of length "+a.v.length+" found");return new Sk.builtin.nmber(a.v.charCodeAt(0),Sk.builtin.nmber.int$)};
Sk.builtin.chr=function(a){Sk.builtin.pyCheckArgs("chr",arguments,1,1);if(!Sk.builtin.checkInt(a))throw new Sk.builtin.TypeError("an integer is required");a=Sk.builtin.asnum$(a);if(0>a||255<a)throw new Sk.builtin.ValueError("chr() arg not in range(256)");return new Sk.builtin.str(String.fromCharCode(a))};
Sk.builtin.int2str_=function(a,b,c){var d="";if(a instanceof Sk.builtin.lng){var e="";2!==b&&(e="L");d=a.str$(b,!1);return a.nb$isnegative()?new Sk.builtin.str("-"+c+d+e):new Sk.builtin.str(c+d+e)}a=Sk.misceval.asIndex(a);d=a.toString(b);return 0>a?new Sk.builtin.str("-"+c+d.slice(1)):new Sk.builtin.str(c+d)};
Sk.builtin.hex=function(a){Sk.builtin.pyCheckArgs("hex",arguments,1,1);if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("hex() argument can't be converted to hex");return Sk.builtin.int2str_(a,16,"0x")};Sk.builtin.oct=function(a){Sk.builtin.pyCheckArgs("oct",arguments,1,1);if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("oct() argument can't be converted to hex");return Sk.builtin.int2str_(a,8,"0")};
Sk.builtin.bin=function(a){Sk.builtin.pyCheckArgs("bin",arguments,1,1);if(!Sk.misceval.isIndex(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object can't be interpreted as an index");return Sk.builtin.int2str_(a,2,"0b")};
Sk.builtin.dir=function(a){Sk.builtin.pyCheckArgs("dir",arguments,1,1);var b=function(a){var b=null;if(-1!==["__bases__","__mro__","__class__"].indexOf(a))return null;-1!==a.indexOf("$")?b=Sk.builtin.dir.slotNameToRichName(a):"_"!==a.charAt(a.length-1)?b=a:"_"===a.charAt(0)&&(b=a);return b},c=[],d,e,f,g,h;for(d in a.constructor.prototype)(e=b(d))&&c.push(new Sk.builtin.str(e));if(a.$d)if(a.$d.tp$iter)for(f=a.$d.tp$iter(),d=f.tp$iternext();void 0!==d;d=f.tp$iternext())e=new Sk.builtin.str(d),(e=b(e.v))&&
c.push(new Sk.builtin.str(e));else for(e in a.$d)c.push(new Sk.builtin.str(e));if(f=a.tp$mro)for(f=a.tp$mro,d=0;d<f.v.length;++d)for(h in g=f.v[d],g)g.hasOwnProperty(h)&&(e=b(h))&&c.push(new Sk.builtin.str(e));c.sort(function(a,b){return(a.v>b.v)-(a.v<b.v)});return new Sk.builtin.list(c.filter(function(a,b,c){return a!==c[b+1]}))};Sk.builtin.dir.slotNameToRichName=function(a){};Sk.builtin.repr=function(a){Sk.builtin.pyCheckArgs("repr",arguments,1,1);return Sk.misceval.objectRepr(a)};
Sk.builtin.open=function(a,b,c){Sk.builtin.pyCheckArgs("open",arguments,1,3);void 0===b&&(b=new Sk.builtin.str("r"));if("r"!==b.v&&"rb"!==b.v)throw"todo; haven't implemented non-read opens";return new Sk.builtin.file(a,b,c)};
Sk.builtin.isinstance=function(a,b){Sk.builtin.pyCheckArgs("isinstance",arguments,2,2);if(!(Sk.builtin.checkClass(b)||b instanceof Sk.builtin.tuple))throw new Sk.builtin.TypeError("isinstance() arg 2 must be a class, type, or tuple of classes and types");if(b===Sk.builtin.int_.prototype.ob$type)return"number"===a.tp$name&&a.skType===Sk.builtin.nmber.int$;if(b===Sk.builtin.float_.prototype.ob$type)return"number"===a.tp$name&&a.skType===Sk.builtin.nmber.float$;if(b===Sk.builtin.none.prototype.ob$type)return a instanceof
Sk.builtin.none;if(a.ob$type===b)return!0;if(b instanceof Sk.builtin.tuple){for(var c=0;c<b.v.length;++c)if(Sk.builtin.isinstance(a,b.v[c]))return!0;return!1}var d=function(a,b){if(a===b)return!0;if(void 0===a.$d)return!1;for(var c=a.$d.mp$subscript(Sk.builtin.type.basesStr_),h=0;h<c.v.length;++h)if(d(c.v[h],b))return!0;return!1};return d(a.ob$type,b)};Sk.builtin.hashCount=0;
Sk.builtin.hash=function(a){Sk.builtin.pyCheckArgs("hash",arguments,1,1);if(a instanceof Object&&void 0!==a.tp$hash){if(a.$savedHash_)return a.$savedHash_;a.$savedHash_=a.tp$hash();return a.$savedHash_}return a instanceof Object&&void 0!==a.__hash__?Sk.misceval.callsim(a.__hash__,a):a instanceof Sk.builtin.bool?a.v?1:0:a instanceof Sk.builtin.none?0:a instanceof Object?(void 0===a.__id&&(Sk.builtin.hashCount+=1,a.__id=Sk.builtin.hashCount),a.__id):"number"===typeof a?a:null===a?0:!0===a?1:!1===a?
0:typeof a+" "+String(a)};Sk.builtin.getattr=function(a,b,c){Sk.builtin.pyCheckArgs("getattr",arguments,2,3);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("attribute name must be string");var d=a.tp$getattr(b.v);if(void 0===d){if(void 0!==c)return c;throw new Sk.builtin.AttributeError("'"+Sk.abstr.typeName(a)+"' object has no attribute '"+b.v+"'");}return d};Sk.builtin.raw_input=function(a,b,c){a=Sk.inputfun(a.v);return new Sk.builtin.str(a)};
Sk.builtin.input=function(a,b,c){a=Sk.inputfun(a.v);return new Sk.builtin.str(a)};Sk.builtin.jseval=function(a){goog.global.eval(a)};Sk.builtin.jsmillis=function(){return(new Date).valueOf()};Sk.builtin.superbi=function(){throw new Sk.builtin.NotImplementedError("super is not yet implemented, please report your use case as a github issue.");};Sk.builtin.eval_=function(){throw new Sk.builtin.NotImplementedError("eval is not yet implemented");};
Sk.builtin.map=function(a,b){Sk.builtin.pyCheckArgs("map",arguments,2);a instanceof Sk.builtin.none&&(a={func_code:function(a){return a}});if(2<arguments.length){var c=[],d=Array.prototype.slice.apply(arguments).slice(1),e;for(e in d){if(void 0===d[e].tp$iter){var f=parseInt(e,10)+2;throw new Sk.builtin.TypeError("argument "+f+" to map() must support iteration");}d[e]=d[e].tp$iter()}for(;;){var g=[],h=0;for(e in d)f=d[e].tp$iternext(),void 0===f?(g.push(Sk.builtin.none.none$),h++):g.push(f);if(h!==
d.length)c.push(g);else break}b=new Sk.builtin.list(c)}if(void 0===b.tp$iter)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");c=[];d=b.tp$iter();for(f=d.tp$iternext();void 0!==f;)f instanceof Array||(f=[f]),c.push(a.func_code.apply(this,f)),f=d.tp$iternext();return new Sk.builtin.list(c)};
Sk.builtin.reduce=function(a,b,c){Sk.builtin.pyCheckArgs("reduce",arguments,2,3);var d=b.tp$iter();if(void 0===c&&(c=d.tp$iternext(),void 0===c))throw new Sk.builtin.TypeError("reduce() of empty sequence with no initial value");for(var e=c,f=d.tp$iternext();void 0!==f;)e=a.func_code(e,f),f=d.tp$iternext();return e};
Sk.builtin.filter=function(a,b){Sk.builtin.pyCheckArgs("filter",arguments,2,2);if(void 0===b.tp$iter)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");a instanceof Sk.builtin.none&&(a={func_code:function(a){return Sk.builtin.bool(a)}});var c=function(){return[]},d=function(a,b){a.push(b);return a},e=function(a){return new Sk.builtin.list(a)};b.__class__===Sk.builtin.str?(c=function(){return new Sk.builtin.str("")},d=function(a,b){return a.sq$concat(b)},e=function(a){return a}):
b.__class__===Sk.builtin.tuple&&(e=function(a){return new Sk.builtin.tuple(a)});var f=b.tp$iter(),g=f.tp$iternext(),c=c();if(void 0===g)return e(c);for(;void 0!==g;)Sk.misceval.isTrue(a.func_code(g))&&(c=d(c,g)),g=f.tp$iternext();return e(c)};
Sk.builtin.hasattr=function(a,b){Sk.builtin.pyCheckArgs("hasattr",arguments,2,2);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("hasattr(): attribute name must be string");if(a.tp$getattr)return a.tp$getattr(b.v)?!0:!1;throw new Sk.builtin.AttributeError("Object has no tp$getattr method");};
Sk.builtin.pow=function(a,b,c){Sk.builtin.pyCheckArgs("pow",arguments,2,3);var d=Sk.builtin.asnum$(a),e=Sk.builtin.asnum$(b);Sk.builtin.asnum$(c);if(!Sk.builtin.checkNumber(a)||!Sk.builtin.checkNumber(b)){if(void 0===c)throw new Sk.builtin.TypeError("unsupported operand type(s) for pow(): '"+Sk.abstr.typeName(a)+"' and '"+Sk.abstr.typeName(b)+"'");throw new Sk.builtin.TypeError("unsupported operand type(s) for pow(): '"+Sk.abstr.typeName(a)+"', '"+Sk.abstr.typeName(b)+"', '"+Sk.abstr.typeName(c)+
"'");}if(0>d&&b.skType===Sk.builtin.nmber.float$)throw new Sk.builtin.ValueError("negative number cannot be raised to a fractional power");if(void 0===c)return d=Math.pow(d,e),a.skType===Sk.builtin.nmber.float$||b.skType===Sk.builtin.nmber.float$||0>e?new Sk.builtin.nmber(d,Sk.builtin.nmber.float$):a instanceof Sk.builtin.lng||b instanceof Sk.builtin.lng?new Sk.builtin.lng(d):new Sk.builtin.nmber(d,Sk.builtin.nmber.int$);if(!Sk.builtin.checkInt(a)||!Sk.builtin.checkInt(b)||!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("pow() 3rd argument not allowed unless all arguments are integers");
if(0>e)throw new Sk.builtin.TypeError("pow() 2nd argument cannot be negative when 3rd argument specified");return a instanceof Sk.builtin.lng||(b instanceof Sk.builtin.lng||c instanceof Sk.builtin.lng)||Infinity===Math.pow(d,e)?(a=new Sk.builtin.lng(a),a.nb$power(b,c)):(new Sk.builtin.nmber(Math.pow(d,e),Sk.builtin.nmber.int$)).nb$remainder(c)};Sk.builtin.quit=function(a){a=(new Sk.builtin.str(a)).v;throw new Sk.builtin.SystemExit(a);};
Sk.builtin.sorted=function(a,b,c,d){var e;if(void 0===c||c instanceof Sk.builtin.none)b instanceof Sk.builtin.none||void 0===b||(e=b),a=new Sk.builtin.list(a);else{e=b instanceof Sk.builtin.none?{func_code:function(a,b){return Sk.misceval.richCompareBool(a[0],b[0],"Lt")?new Sk.builtin.nmber(-1,Sk.builtin.nmber.int$):new Sk.builtin.nmber(0,Sk.builtin.nmber.int$)}}:{func_code:function(a,c){return b.func_code(a[0],c[0])}};a=a.tp$iter();for(var f=a.tp$iternext(),g=[];void 0!==f;)g.push([c.func_code(f),
f]),f=a.tp$iternext();a=new Sk.builtin.list(g)}void 0!==e?a.list_sort_(a,e):a.list_sort_(a);d&&a.list_reverse_(a);if(void 0!==c&&!(c instanceof Sk.builtin.none)){a=a.tp$iter();f=a.tp$iternext();for(g=[];void 0!==f;)g.push(f[1]),f=a.tp$iternext();a=new Sk.builtin.list(g)}return a};Sk.builtin.bytearray=function(){throw new Sk.builtin.NotImplementedError("bytearray is not yet implemented");};Sk.builtin.callable=function(){throw new Sk.builtin.NotImplementedError("callable is not yet implemented");};
Sk.builtin.complex=function(){throw new Sk.builtin.NotImplementedError("complex is not yet implemented");};Sk.builtin.delattr=function(){throw new Sk.builtin.NotImplementedError("delattr is not yet implemented");};Sk.builtin.divmod=function(){throw new Sk.builtin.NotImplementedError("divmod is not yet implemented");};Sk.builtin.execfile=function(){throw new Sk.builtin.NotImplementedError("execfile is not yet implemented");};
Sk.builtin.format=function(){throw new Sk.builtin.NotImplementedError("format is not yet implemented");};Sk.builtin.frozenset=function(){throw new Sk.builtin.NotImplementedError("frozenset is not yet implemented");};Sk.builtin.globals=function(){throw new Sk.builtin.NotImplementedError("globals is not yet implemented");};Sk.builtin.help=function(){throw new Sk.builtin.NotImplementedError("help is not yet implemented");};
Sk.builtin.issubclass=function(){throw new Sk.builtin.NotImplementedError("issubclass is not yet implemented");};Sk.builtin.iter=function(){throw new Sk.builtin.NotImplementedError("iter is not yet implemented");};Sk.builtin.locals=function(){throw new Sk.builtin.NotImplementedError("locals is not yet implemented");};Sk.builtin.memoryview=function(){throw new Sk.builtin.NotImplementedError("memoryview is not yet implemented");};
Sk.builtin.next_=function(){throw new Sk.builtin.NotImplementedError("next is not yet implemented");};Sk.builtin.property=function(){throw new Sk.builtin.NotImplementedError("property is not yet implemented");};Sk.builtin.reload=function(){throw new Sk.builtin.NotImplementedError("reload is not yet implemented");};Sk.builtin.reversed=function(){throw new Sk.builtin.NotImplementedError("reversed is not yet implemented");};
Sk.builtin.unichr=function(){throw new Sk.builtin.NotImplementedError("unichr is not yet implemented");};Sk.builtin.vars=function(){throw new Sk.builtin.NotImplementedError("vars is not yet implemented");};Sk.builtin.xrange=Sk.builtin.range;Sk.builtin.apply_=function(){throw new Sk.builtin.NotImplementedError("apply is not yet implemented");};Sk.builtin.buffer=function(){throw new Sk.builtin.NotImplementedError("buffer is not yet implemented");};
Sk.builtin.coerce=function(){throw new Sk.builtin.NotImplementedError("coerce is not yet implemented");};Sk.builtin.intern=function(){throw new Sk.builtin.NotImplementedError("intern is not yet implemented");};Sk.builtin.Exception=function(a){a=Array.prototype.slice.call(arguments);for(var b=0;b<a.length;++b)"string"===typeof a[b]&&(a[b]=new Sk.builtin.str(a[b]));this.args=new Sk.builtin.tuple(a);Sk.currFilename?this.filename=Sk.currFilename:3<=this.args.sq$length()?this.filename=this.args.v[1].v?this.args.v[1].v:"<unknown>":this.filename="<unknown>";3<=this.args.sq$length()?this.lineno=this.args.v[2]:this.lineno=0<Sk.currLineNo?Sk.currLineNo:"<unknown>";this.colno=0<Sk.currColNo?Sk.currColNo:"<unknown>"};
Sk.builtin.Exception.prototype.tp$name="Exception";Sk.builtin.Exception.prototype.tp$str=function(){var a;a=""+this.tp$name;this.args&&(a+=": "+(0<this.args.v.length?this.args.v[0].v:""));a+=" on line "+this.lineno;if(4<this.args.v.length){a+="\n"+this.args.v[4].v+"\n";for(var b=0;b<this.args.v[3];++b)a+=" ";a+="^\n"}return new Sk.builtin.str(a)};Sk.builtin.Exception.prototype.toString=function(){return this.tp$str().v};goog.exportSymbol("Sk.builtin.Exception",Sk.builtin.Exception);
Sk.builtin.AssertionError=function(a){if(!(this instanceof Sk.builtin.AssertionError)){var b=Object.create(Sk.builtin.AssertionError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.AssertionError,Sk.builtin.Exception);Sk.builtin.AssertionError.prototype.tp$name="AssertionError";goog.exportSymbol("Sk.builtin.AssertionError",Sk.builtin.AssertionError);
Sk.builtin.AttributeError=function(a){if(!(this instanceof Sk.builtin.AttributeError)){var b=Object.create(Sk.builtin.AttributeError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.AttributeError,Sk.builtin.Exception);Sk.builtin.AttributeError.prototype.tp$name="AttributeError";
Sk.builtin.ImportError=function(a){if(!(this instanceof Sk.builtin.ImportError)){var b=Object.create(Sk.builtin.ImportError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ImportError,Sk.builtin.Exception);Sk.builtin.ImportError.prototype.tp$name="ImportError";
Sk.builtin.IndentationError=function(a){if(!(this instanceof Sk.builtin.IndentationError)){var b=Object.create(Sk.builtin.IndentationError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.IndentationError,Sk.builtin.Exception);Sk.builtin.IndentationError.prototype.tp$name="IndentationError";
Sk.builtin.IndexError=function(a){if(!(this instanceof Sk.builtin.IndexError)){var b=Object.create(Sk.builtin.IndexError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.IndexError,Sk.builtin.Exception);Sk.builtin.IndexError.prototype.tp$name="IndexError";
Sk.builtin.KeyError=function(a){if(!(this instanceof Sk.builtin.KeyError)){var b=Object.create(Sk.builtin.KeyError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.KeyError,Sk.builtin.Exception);Sk.builtin.KeyError.prototype.tp$name="KeyError";
Sk.builtin.NameError=function(a){if(!(this instanceof Sk.builtin.NameError)){var b=Object.create(Sk.builtin.NameError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.NameError,Sk.builtin.Exception);Sk.builtin.NameError.prototype.tp$name="NameError";
Sk.builtin.OverflowError=function(a){if(!(this instanceof Sk.builtin.OverflowError)){var b=Object.create(Sk.builtin.OverflowError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.OverflowError,Sk.builtin.Exception);Sk.builtin.OverflowError.prototype.tp$name="OverflowError";
Sk.builtin.ParseError=function(a){if(!(this instanceof Sk.builtin.ParseError)){var b=Object.create(Sk.builtin.ParseError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ParseError,Sk.builtin.Exception);Sk.builtin.ParseError.prototype.tp$name="ParseError";
Sk.builtin.SystemExit=function(a){if(!(this instanceof Sk.builtin.SystemExit)){var b=Object.create(Sk.builtin.SystemExit.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.SystemExit,Sk.builtin.Exception);Sk.builtin.SystemExit.prototype.tp$name="SystemExit";goog.exportSymbol("Sk.builtin.SystemExit",Sk.builtin.SystemExit);
Sk.builtin.SyntaxError=function(a){if(!(this instanceof Sk.builtin.SyntaxError)){var b=Object.create(Sk.builtin.SyntaxError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.SyntaxError,Sk.builtin.Exception);Sk.builtin.SyntaxError.prototype.tp$name="SyntaxError";
Sk.builtin.TokenError=function(a){if(!(this instanceof Sk.builtin.TokenError)){var b=Object.create(Sk.builtin.TokenError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.TokenError,Sk.builtin.Exception);Sk.builtin.TokenError.prototype.tp$name="TokenError";
Sk.builtin.TypeError=function(a){if(!(this instanceof Sk.builtin.TypeError)){var b=Object.create(Sk.builtin.TypeError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.TypeError,Sk.builtin.Exception);Sk.builtin.TypeError.prototype.tp$name="TypeError";goog.exportSymbol("Sk.builtin.TypeError",Sk.builtin.TypeError);
Sk.builtin.ValueError=function(a){if(!(this instanceof Sk.builtin.ValueError)){var b=Object.create(Sk.builtin.ValueError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ValueError,Sk.builtin.Exception);Sk.builtin.ValueError.prototype.tp$name="ValueError";goog.exportSymbol("Sk.builtin.ValueError",Sk.builtin.ValueError);
Sk.builtin.ZeroDivisionError=function(a){if(!(this instanceof Sk.builtin.ZeroDivisionError)){var b=Object.create(Sk.builtin.ZeroDivisionError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.ZeroDivisionError,Sk.builtin.Exception);Sk.builtin.ZeroDivisionError.prototype.tp$name="ZeroDivisionError";
Sk.builtin.TimeLimitError=function(a){if(!(this instanceof Sk.builtin.TimeLimitError)){var b=Object.create(Sk.builtin.TimeLimitError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.TimeLimitError,Sk.builtin.Exception);Sk.builtin.TimeLimitError.prototype.tp$name="TimeLimitError";goog.exportSymbol("Sk.builtin.TimeLimitError",Sk.builtin.TimeLimitError);
Sk.builtin.IOError=function(a){if(!(this instanceof Sk.builtin.IOError)){var b=Object.create(Sk.builtin.IOError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.IOError,Sk.builtin.Exception);Sk.builtin.IOError.prototype.tp$name="IOError";goog.exportSymbol("Sk.builtin.IOError",Sk.builtin.IOError);
Sk.builtin.NotImplementedError=function(a){if(!(this instanceof Sk.builtin.NotImplementedError)){var b=Object.create(Sk.builtin.NotImplementedError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.NotImplementedError,Sk.builtin.Exception);Sk.builtin.NotImplementedError.prototype.tp$name="NotImplementedError";goog.exportSymbol("Sk.builtin.NotImplementedError",Sk.builtin.NotImplementedError);
Sk.builtin.NegativePowerError=function(a){if(!(this instanceof Sk.builtin.NegativePowerError)){var b=Object.create(Sk.builtin.NegativePowerError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.NegativePowerError,Sk.builtin.Exception);Sk.builtin.NegativePowerError.prototype.tp$name="NegativePowerError";goog.exportSymbol("Sk.builtin.NegativePowerError",Sk.builtin.NegativePowerError);
Sk.builtin.OperationError=function(a){if(!(this instanceof Sk.builtin.OperationError)){var b=Object.create(Sk.builtin.OperationError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.OperationError,Sk.builtin.Exception);Sk.builtin.OperationError.prototype.tp$name="OperationError";goog.exportSymbol("Sk.builtin.OperationError",Sk.builtin.OperationError);
Sk.builtin.SystemError=function(a){if(!(this instanceof Sk.builtin.SystemError)){var b=Object.create(Sk.builtin.SystemError.prototype);b.constructor.apply(b,arguments);return b}Sk.builtin.Exception.apply(this,arguments)};goog.inherits(Sk.builtin.SystemError,Sk.builtin.Exception);Sk.builtin.SystemError.prototype.tp$name="SystemError";goog.exportSymbol("Sk.builtin.SystemError",Sk.builtin.SystemError);Sk.currLineNo=-1;Sk.currColNo=-1;Sk.currFilename="";goog.exportSymbol("Sk",Sk);
goog.exportProperty(Sk,"currLineNo",Sk.currLineNo);goog.exportProperty(Sk,"currColNo",Sk.currColNo);goog.exportProperty(Sk,"currFilename",Sk.currFilename);Sk.builtin.type=function(a,b,c){if(void 0===b&&void 0===c)return a.constructor===Sk.builtin.nmber?a.skType===Sk.builtin.nmber.int$?Sk.builtin.int_.prototype.ob$type:Sk.builtin.float_.prototype.ob$type:a.ob$type;var d=function(a,b,c,e){if(!(this instanceof d))return new d(a,b,c,e);e=e||[];this.$d=new Sk.builtin.dict([]);var l=Sk.builtin.type.typeLookup(this.ob$type,"__init__");void 0!==l&&(e.unshift(this),Sk.misceval.apply(l,a,b,c,e));return this},e;for(e in c)d.prototype[e]=c[e],d[e]=c[e];d.__class__=
d;d.sk$klass=!0;d.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;d.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;d.prototype.tp$descr_get=function(){goog.asserts.fail("in type tp$descr_get")};d.prototype.$r=function(){var b=this.tp$getattr("__repr__");if(void 0!==b)return Sk.misceval.apply(b,void 0,void 0,void 0,[]);var b=c.__module__,d="";b&&(d=b.v+".");return new Sk.builtin.str("<"+d+a+" object>")};d.prototype.tp$str=function(){var a=this.tp$getattr("__str__");
return void 0!==a?Sk.misceval.apply(a,void 0,void 0,void 0,[]):this.$r()};d.prototype.tp$length=function(){var a=this.tp$getattr("__len__");if(void 0!==a)return Sk.misceval.apply(a,void 0,void 0,void 0,[]);a=Sk.abstr.typeName(this);throw new Sk.builtin.AttributeError(a+" instance has no attribute '__len__'");};d.prototype.tp$call=function(a,b){var c=this.tp$getattr("__call__");if(c)return Sk.misceval.apply(c,void 0,void 0,b,a);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object is not callable");
};d.prototype.tp$iter=function(){var a=this.tp$getattr("__iter__"),b=Sk.abstr.typeName(this);if(a)return Sk.misceval.callsim(a);throw new Sk.builtin.TypeError("'"+b+"' object is not iterable");};d.prototype.tp$iternext=function(){var a=this.tp$getattr("next");goog.asserts.assert(void 0!==a,"iter() should have caught this");return Sk.misceval.callsim(a)};d.prototype.tp$getitem=function(a){var b=this.tp$getattr("__getitem__");if(void 0!==b)return Sk.misceval.apply(b,void 0,void 0,void 0,[a]);throw new Sk.builtin.TypeError("'"+
Sk.abstr.typeName(this)+"' object does not support indexing");};d.prototype.tp$setitem=function(a,b){var c=this.tp$getattr("__setitem__");if(void 0!==c)return Sk.misceval.apply(c,void 0,void 0,void 0,[a,b]);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(this)+"' object does not support item assignment");};d.prototype.tp$name=a;b&&(d.$d=new Sk.builtin.dict([]),d.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,new Sk.builtin.tuple(b)),b=Sk.builtin.type.buildMRO(d),d.$d.mp$ass_subscript(Sk.builtin.type.mroStr_,
b),d.tp$mro=b);d.prototype.ob$type=d;Sk.builtin.type.makeIntoTypeObj(a,d);d.tp$setattr=Sk.builtin.type.prototype.tp$setattr;return d};Sk.builtin.type.makeTypeObj=function(a,b){Sk.builtin.type.makeIntoTypeObj(a,b);return b};
Sk.builtin.type.makeIntoTypeObj=function(a,b){goog.asserts.assert(void 0!==a);goog.asserts.assert(void 0!==b);b.ob$type=Sk.builtin.type;b.tp$name=a;b.$r=function(){var a=b.__module__,d="";a&&(d=a.v+".");var e="class";a||b.sk$klass||(e="type");return new Sk.builtin.str("<"+e+" '"+d+b.tp$name+"'>")};b.tp$str=void 0;b.tp$getattr=Sk.builtin.type.prototype.tp$getattr;b.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;b.tp$richcompare=Sk.builtin.type.prototype.tp$richcompare;b.sk$type=!0;return b};
Sk.builtin.type.ob$type=Sk.builtin.type;Sk.builtin.type.tp$name="type";Sk.builtin.type.$r=function(){return new Sk.builtin.str("<type 'type'>")};Sk.builtin.type.prototype.tp$getattr=function(a){var b=Sk.builtin.type.typeLookup(this,a),c;void 0!==b&&(null!==b&&void 0!==b.ob$type)&&(c=b.ob$type.tp$descr_get);if(this.$d&&(a=this.$d.mp$lookup(new Sk.builtin.str(a)),void 0!==a))return a;if(c)return c.call(b,null,this);if(void 0!==b)return b};Sk.builtin.type.prototype.tp$setattr=function(a,b){this[a]=b};
Sk.builtin.type.typeLookup=function(a,b){var c=a.tp$mro,d=new Sk.builtin.str(b),e,f;if(!c)return a.prototype[b];for(f=0;f<c.v.length;++f){e=c.v[f];if(e.hasOwnProperty(b))return e[b];e=e.$d.mp$lookup(d);if(void 0!==e)return e}};
Sk.builtin.type.mroMerge_=function(a){for(var b=[];;){for(var c=0;c<a.length;++c){var d=a[c];if(0!==d.length)break}if(c===a.length)return b;for(var e=[],c=0;c<a.length;++c)if(d=a[c],0!==d.length){var d=d[0],f=0;a:for(;f<a.length;++f)for(var g=a[f],h=1;h<g.length;++h)if(g[h]===d)break a;f===a.length&&e.push(d)}if(0===e.length)throw new Sk.builtin.TypeError("Inconsistent precedences in type hierarchy");e=e[0];b.push(e);for(c=0;c<a.length;++c)d=a[c],0<d.length&&d[0]===e&&d.splice(0,1)}};
Sk.builtin.type.buildMRO_=function(a){var b=[[a]];a=a.$d.mp$subscript(Sk.builtin.type.basesStr_);for(var c=0;c<a.v.length;++c)b.push(Sk.builtin.type.buildMRO_(a.v[c]));for(var d=[],c=0;c<a.v.length;++c)d.push(a.v[c]);b.push(d);return Sk.builtin.type.mroMerge_(b)};Sk.builtin.type.buildMRO=function(a){return new Sk.builtin.tuple(Sk.builtin.type.buildMRO_(a))};
Sk.builtin.type.prototype.tp$richcompare=function(a,b){if(a.ob$type==Sk.builtin.type&&this.$r&&a.$r){var c=this.$r(),d=a.$r();return c.tp$richcompare(d,b)}};Sk.builtin.object=function(){if(!(this instanceof Sk.builtin.object))return new Sk.builtin.object;this.$d=new Sk.builtin.dict([]);return this};
Sk.builtin.object.prototype.GenericGetAttr=function(a){goog.asserts.assert("string"===typeof a);var b=this.ob$type;goog.asserts.assert(void 0!==b,"object has no ob$type!");var b=Sk.builtin.type.typeLookup(b,a),c;void 0!==b&&(null!==b&&void 0!==b.ob$type)&&(c=b.ob$type.tp$descr_get);if(this.$d){var d;if(this.$d.mp$lookup)d=this.$d.mp$lookup(new Sk.builtin.str(a));else if(this.$d.mp$subscript)try{d=this.$d.mp$subscript(new Sk.builtin.str(a))}catch(e){d=void 0}else"object"===typeof this.$d&&(d=this.$d[a]);
if(void 0!==d)return d}if(c)return c.call(b,this,this.ob$type);if(void 0!==b)return b};goog.exportSymbol("Sk.builtin.object.prototype.GenericGetAttr",Sk.builtin.object.prototype.GenericGetAttr);Sk.builtin.object.prototype.GenericSetAttr=function(a,b){goog.asserts.assert("string"===typeof a);this.$d.mp$ass_subscript?this.$d.mp$ass_subscript(new Sk.builtin.str(a),b):"object"===typeof this.$d&&(this.$d[a]=b)};goog.exportSymbol("Sk.builtin.object.prototype.GenericSetAttr",Sk.builtin.object.prototype.GenericSetAttr);
Sk.builtin.object.prototype.HashNotImplemented=function(){throw new Sk.builtin.TypeError("unhashable type: '"+Sk.abstr.typeName(this)+"'");};Sk.builtin.object.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.object.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;Sk.builtin.object.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("object",Sk.builtin.object);Sk.builtin.none=function(){};
Sk.builtin.none.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("NoneType",Sk.builtin.none);Sk.builtin.none.prototype.tp$name="NoneType";Sk.builtin.none.none$=Object.create(Sk.builtin.none.prototype,{v:{value:null,enumerable:!0}});goog.exportSymbol("Sk.builtin.none",Sk.builtin.none);Sk.builtin.bool=function(a){Sk.builtin.pyCheckArgs("bool",arguments,1);return Sk.misceval.isTrue(a)?Sk.builtin.bool.true$:Sk.builtin.bool.false$};Sk.builtin.bool.prototype.tp$name="bool";Sk.builtin.bool.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("bool",Sk.builtin.bool);Sk.builtin.bool.prototype.$r=function(){return this.v?new Sk.builtin.str("True"):new Sk.builtin.str("False")};Sk.builtin.bool.true$=Object.create(Sk.builtin.bool.prototype,{v:{value:!0,enumerable:!0}});
Sk.builtin.bool.false$=Object.create(Sk.builtin.bool.prototype,{v:{value:!1,enumerable:!0}});goog.exportSymbol("Sk.builtin.bool",Sk.builtin.bool);Sk.builtin.pyCheckArgs=function(a,b,c,d,e,f){b=b.length;var g="";void 0===d&&(d=Infinity);e&&(b-=1);f&&(b-=1);if(b<c||b>d)throw g=(c===d?a+"() takes exactly "+c+" arguments":b<c?a+"() takes at least "+c+" arguments":a+"() takes at most "+d+" arguments")+(" ("+b+" given)"),new Sk.builtin.TypeError(g);};goog.exportSymbol("Sk.builtin.pyCheckArgs",Sk.builtin.pyCheckArgs);Sk.builtin.pyCheckType=function(a,b,c){if(!c)throw new Sk.builtin.TypeError(a+" must be a "+b);};
goog.exportSymbol("Sk.builtin.pyCheckType",Sk.builtin.pyCheckType);Sk.builtin.checkSequence=function(a){return null!==a&&void 0!==a.mp$subscript};goog.exportSymbol("Sk.builtin.checkSequence",Sk.builtin.checkSequence);Sk.builtin.checkIterable=function(a){return null!==a&&void 0!==a.tp$iter};goog.exportSymbol("Sk.builtin.checkIterable",Sk.builtin.checkIterable);Sk.builtin.checkNumber=function(a){return null!==a&&("number"===typeof a||a instanceof Sk.builtin.nmber||a instanceof Sk.builtin.lng)};
goog.exportSymbol("Sk.builtin.checkNumber",Sk.builtin.checkNumber);Sk.builtin.checkInt=function(a){return null!==a&&("number"===typeof a&&a===(a|0)||a instanceof Sk.builtin.nmber&&a.skType===Sk.builtin.nmber.int$||a instanceof Sk.builtin.lng)};goog.exportSymbol("Sk.builtin.checkInt",Sk.builtin.checkInt);Sk.builtin.checkString=function(a){return null!==a&&a.__class__==Sk.builtin.str};goog.exportSymbol("Sk.builtin.checkString",Sk.builtin.checkString);
Sk.builtin.checkClass=function(a){return null!==a&&a.sk$type};goog.exportSymbol("Sk.builtin.checkClass",Sk.builtin.checkClass);Sk.builtin.checkBool=function(a){return a instanceof Sk.builtin.bool};goog.exportSymbol("Sk.builtin.checkBool",Sk.builtin.checkBool);Sk.builtin.checkFunction=function(a){return null!==a&&void 0!==a.tp$call};goog.exportSymbol("Sk.builtin.checkFunction",Sk.builtin.checkFunction);
Sk.builtin.func=function(a,b,c,d){this.func_code=a;this.func_globals=b||null;if(void 0!==d)for(var e in d)c[e]=d[e];this.func_closure=c;return this};goog.exportSymbol("Sk.builtin.func",Sk.builtin.func);Sk.builtin.func.prototype.tp$name="function";Sk.builtin.func.prototype.tp$descr_get=function(a,b){goog.asserts.assert(void 0!==a&&void 0!==b);return null==a?this:new Sk.builtin.method(this,a)};
Sk.builtin.func.prototype.tp$call=function(a,b){var c;this.func_closure&&a.push(this.func_closure);c=this.func_code.co_kwargs;var d=[];if(this.func_code.no_kw&&b)throw c=this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||"<native JS>",new Sk.builtin.TypeError(c+"() takes no keyword arguments");if(b)for(var e=b.length,f=this.func_code.co_varnames,g=f&&f.length,h=0;h<e;h+=2){for(var k=0;k<g&&b[h]!==f[k];++k);if(f&&k!==g)a[k]=b[h+1];else if(c)d.push(new Sk.builtin.str(b[h])),d.push(b[h+
1]);else throw c=this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||"<native JS>",new Sk.builtin.TypeError(c+"() got an unexpected keyword argument '"+b[h]+"'");}c&&a.unshift(d);return this.func_code.apply(this.func_globals,a)};Sk.builtin.func.prototype.tp$getattr=function(a){return this[a]};Sk.builtin.func.prototype.tp$setattr=function(a,b){this[a]=b};Sk.builtin.func.prototype.ob$type=Sk.builtin.type.makeTypeObj("function",new Sk.builtin.func(null,null));
Sk.builtin.func.prototype.$r=function(){return new Sk.builtin.str("<function "+(this.func_code&&this.func_code.co_name&&this.func_code.co_name.v||"<native JS>")+">")};Sk.nativejs={FN_ARGS:/^function\s*[^\(]*\(\s*([^\)]*)\)/m,FN_ARG_SPLIT:/,/,FN_ARG:/^\s*(_?)(\S+?)\1\s*$/,STRIP_COMMENTS:/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,formalParameterList:function(a){var b=[];a=a.toString().replace(this.STRIP_COMMENTS,"").match(this.FN_ARGS)[1].split(this.FN_ARG_SPLIT);for(var c in a)a[c].replace(this.FN_ARG,function(a,c,f){b.push(f)});return b},func:function(a){a.co_name=new Sk.builtin.str(a.name);a.co_varnames=Sk.nativejs.formalParameterList(a);return new Sk.builtin.func(a)},
func_nokw:function(a){a.co_name=new Sk.builtin.str(a.name);a.co_varnames=Sk.nativejs.formalParameterList(a);a.no_kw=!0;return new Sk.builtin.func(a)}};goog.exportSymbol("Sk.nativejs.func",Sk.nativejs.func);goog.exportSymbol("Sk.nativejs.func_nokw",Sk.nativejs.func_nokw);Sk.builtin.method=function(a,b){this.im_func=a;this.im_self=b};goog.exportSymbol("Sk.builtin.method",Sk.builtin.method);
Sk.builtin.method.prototype.tp$call=function(a,b){goog.asserts.assert(this.im_self,"should just be a function, not a method since there's no self?");goog.asserts.assert(this.im_func instanceof Sk.builtin.func);a.unshift(this.im_self);if(b)for(var c=b.length,d=0;d<c;d+=2){for(var e=this.im_func.func_code.co_varnames,f=e&&e.length,g=0;g<f&&b[d]!==e[g];++g);a[g]=b[d+1]}return this.im_func.func_code.apply(this.im_func.func_globals,a)};
Sk.builtin.method.prototype.$r=function(){return new Sk.builtin.str("<bound method "+this.im_self.ob$type.tp$name+"."+(this.im_func.func_code&&this.im_func.func_code.co_name&&this.im_func.func_code.co_name.v||"<native JS>")+" of "+this.im_self.$r().v+">")};Sk.misceval={};Sk.misceval.isIndex=function(a){return null===a||a.constructor===Sk.builtin.lng||a.tp$index||!0===a||!1===a?!0:Sk.builtin.checkInt(a)};goog.exportSymbol("Sk.misceval.isIndex",Sk.misceval.isIndex);Sk.misceval.asIndex=function(a){if(Sk.misceval.isIndex(a)&&null!==a){if(!0===a)return 1;if(!1===a)return 0;if("number"===typeof a)return a;if(a.constructor===Sk.builtin.nmber)return a.v;if(a.constructor===Sk.builtin.lng)return a.tp$index();goog.asserts.fail("todo;")}};
Sk.misceval.applySlice=function(a,b,c){return a.sq$slice&&Sk.misceval.isIndex(b)&&Sk.misceval.isIndex(c)?(b=Sk.misceval.asIndex(b),void 0===b&&(b=0),c=Sk.misceval.asIndex(c),void 0===c&&(c=1E100),Sk.abstr.sequenceGetSlice(a,b,c)):Sk.abstr.objectGetItem(a,new Sk.builtin.slice(b,c,null))};goog.exportSymbol("Sk.misceval.applySlice",Sk.misceval.applySlice);
Sk.misceval.assignSlice=function(a,b,c,d){if(a.sq$ass_slice&&Sk.misceval.isIndex(b)&&Sk.misceval.isIndex(c))b=Sk.misceval.asIndex(b)||0,c=Sk.misceval.asIndex(c)||1E100,null===d?Sk.abstr.sequenceDelSlice(a,b,c):Sk.abstr.sequenceSetSlice(a,b,c,d);else return c=new Sk.builtin.slice(b,c),null===d?Sk.abstr.objectDelItem(a,c):Sk.abstr.objectSetItem(a,c,d)};goog.exportSymbol("Sk.misceval.assignSlice",Sk.misceval.assignSlice);
Sk.misceval.arrayFromArguments=function(a){if(1!=a.length)return a;var b=a[0];if(b instanceof Sk.builtin.set)b=b.tp$iter().$obj;else if(b instanceof Sk.builtin.dict)b=Sk.builtin.dict.prototype.keys.func_code(b);else if(b instanceof Sk.builtin.str){a=[];for(var b=b.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())a.push(c);return a}return b instanceof Sk.builtin.list||b instanceof Sk.builtin.tuple?b.v:a};goog.exportSymbol("Sk.misceval.arrayFromArguments",Sk.misceval.arrayFromArguments);
Sk.misceval.swappedOp_={Eq:"Eq",NotEq:"NotEq",Lt:"GtE",LtE:"Gt",Gt:"LtE",GtE:"Lt",Is:"IsNot",IsNot:"Is",In_:"NotIn",NotIn:"In_"};
Sk.misceval.richCompareBool=function(a,b,c){goog.asserts.assert(null!==a&&void 0!==a,"passed undefined or null parameter to Sk.misceval.richCompareBool");goog.asserts.assert(null!==b&&void 0!==b,"passed undefined or null parameter to Sk.misceval.richCompareBool");var d=new Sk.builtin.type(a),e=new Sk.builtin.type(b);if(d!==e&&("GtE"===c||"Gt"===c||"LtE"===c||"Lt"===c)){var f=[Sk.builtin.float_.prototype.ob$type,Sk.builtin.int_.prototype.ob$type,Sk.builtin.lng.prototype.ob$type,Sk.builtin.bool.prototype.ob$type],
g=[Sk.builtin.dict.prototype.ob$type,Sk.builtin.enumerate.prototype.ob$type,Sk.builtin.list.prototype.ob$type,Sk.builtin.str.prototype.ob$type,Sk.builtin.tuple.prototype.ob$type],h=f.indexOf(d),k=g.indexOf(d),f=f.indexOf(e),g=g.indexOf(e);if(d===Sk.builtin.none.prototype.ob$type)switch(c){case "Lt":return!0;case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(e===Sk.builtin.none.prototype.ob$type)switch(c){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;case "GtE":return!0}if(-1!==
h&&-1!==g)switch(c){case "Lt":return!0;case "LtE":return!0;case "Gt":return!1;case "GtE":return!1}if(-1!==k&&-1!==f)switch(c){case "Lt":return!1;case "LtE":return!1;case "Gt":return!0;case "GtE":return!0}if(-1!==k&&-1!==g)switch(c){case "Lt":return k<g;case "LtE":return k<=g;case "Gt":return k>g;case "GtE":return k>=g}}if("Is"===c)return a instanceof Sk.builtin.nmber&&b instanceof Sk.builtin.nmber?0===a.numberCompare(b)&&a.skType===b.skType:a instanceof Sk.builtin.lng&&b instanceof Sk.builtin.lng?
0===a.longCompare(b):a===b;if("IsNot"===c)return a instanceof Sk.builtin.nmber&&b instanceof Sk.builtin.nmber?0!==a.numberCompare(b)||a.skType!==b.skType:a instanceof Sk.builtin.lng&&b instanceof Sk.builtin.lng?0!==a.longCompare(b):a!==b;if("In"===c)return Sk.abstr.sequenceContains(b,a);if("NotIn"===c)return!Sk.abstr.sequenceContains(b,a);var l;if(a.tp$richcompare&&void 0!==(l=a.tp$richcompare(b,c))||b.tp$richcompare&&void 0!==(l=b.tp$richcompare(a,Sk.misceval.swappedOp_[c])))return l;e={Eq:"__eq__",
NotEq:"__ne__",Gt:"__gt__",GtE:"__ge__",Lt:"__lt__",LtE:"__le__"};d=e[c];e=e[Sk.misceval.swappedOp_[c]];if(a[d])return Sk.misceval.callsim(a[d],a,b);if(b[e])return Sk.misceval.callsim(b[e],b,a);if(a.__cmp__){d=Sk.misceval.callsim(a.__cmp__,a,b);d=Sk.builtin.asnum$(d);if("Eq"===c)return 0===d;if("NotEq"===c)return 0!==d;if("Lt"===c)return 0>d;if("Gt"===c)return 0<d;if("LtE"===c)return 0>=d;if("GtE"===c)return 0<=d}if(b.__cmp__){d=Sk.misceval.callsim(b.__cmp__,b,a);d=Sk.builtin.asnum$(d);if("Eq"===
c)return 0===d;if("NotEq"===c)return 0!==d;if("Lt"===c)return 0<d;if("Gt"===c)return 0>d;if("LtE"===c)return 0<=d;if("GtE"===c)return 0>=d}if(a instanceof Sk.builtin.none&&b instanceof Sk.builtin.none||a instanceof Sk.builtin.bool&&b instanceof Sk.builtin.bool){if("Eq"===c)return a.v===b.v;if("NotEq"===c)return a.v!==b.v;if("Gt"===c)return a.v>b.v;if("GtE"===c)return a.v>=b.v;if("Lt"===c)return a.v<b.v;if("LtE"===c)return a.v<=b.v}if("Eq"===c)return a instanceof Sk.builtin.str&&b instanceof Sk.builtin.str?
a.v===b.v:a===b;if("NotEq"===c)return a instanceof Sk.builtin.str&&b instanceof Sk.builtin.str?a.v!==b.v:a!==b;a=Sk.abstr.typeName(a);b=Sk.abstr.typeName(b);throw new Sk.builtin.ValueError("don't know how to compare '"+a+"' and '"+b+"'");};goog.exportSymbol("Sk.misceval.richCompareBool",Sk.misceval.richCompareBool);
Sk.misceval.objectRepr=function(a){goog.asserts.assert(void 0!==a,"trying to repr undefined");return null===a||a instanceof Sk.builtin.none?new Sk.builtin.str("None"):!0===a?new Sk.builtin.str("True"):!1===a?new Sk.builtin.str("False"):"number"===typeof a?new Sk.builtin.str(""+a):a.$r?a.constructor===Sk.builtin.nmber?Infinity===a.v?new Sk.builtin.str("inf"):-Infinity===a.v?new Sk.builtin.str("-inf"):new Sk.builtin.str(""+a.v):a.$r():a.tp$name?new Sk.builtin.str("<"+a.tp$name+" object>"):new Sk.builtin.str("<unknown>")};
goog.exportSymbol("Sk.misceval.objectRepr",Sk.misceval.objectRepr);Sk.misceval.opAllowsEquality=function(a){switch(a){case "LtE":case "Eq":case "GtE":return!0}return!1};goog.exportSymbol("Sk.misceval.opAllowsEquality",Sk.misceval.opAllowsEquality);
Sk.misceval.isTrue=function(a){return!0===a?!0:!1===a||null===a||a.constructor===Sk.builtin.none?!1:a.constructor===Sk.builtin.bool?a.v:"number"===typeof a?0!==a:a instanceof Sk.builtin.lng?a.nb$nonzero():a.constructor===Sk.builtin.nmber?0!==a.v:a.mp$length?0!==a.mp$length():a.sq$length?0!==a.sq$length():!0};goog.exportSymbol("Sk.misceval.isTrue",Sk.misceval.isTrue);Sk.misceval.softspace_=!1;
Sk.misceval.print_=function(a){Sk.misceval.softspace_&&("\n"!==a&&Sk.output(" "),Sk.misceval.softspace_=!1);a=new Sk.builtin.str(a);Sk.output(a.v);if(0===a.v.length||"\n"!==a.v[a.v.length-1]&&"\t"!==a.v[a.v.length-1]&&"\r"!==a.v[a.v.length-1]||" "===a.v[a.v.length-1])Sk.misceval.softspace_=!0};goog.exportSymbol("Sk.misceval.print_",Sk.misceval.print_);
Sk.misceval.loadname=function(a,b){var c=b[a];if(void 0!==c)return c;c=Sk.builtins[a];if(void 0!==c)return c;a=a.replace("_$rw$","");a=a.replace("_$rn$","");throw new Sk.builtin.NameError("name '"+a+"' is not defined");};goog.exportSymbol("Sk.misceval.loadname",Sk.misceval.loadname);Sk.misceval.call=function(a,b,c,d,e){e=Array.prototype.slice.call(arguments,4);return Sk.misceval.apply(a,b,c,d,e)};goog.exportSymbol("Sk.misceval.call",Sk.misceval.call);
Sk.misceval.callsim=function(a,b){b=Array.prototype.slice.call(arguments,1);return Sk.misceval.apply(a,void 0,void 0,void 0,b)};goog.exportSymbol("Sk.misceval.callsim",Sk.misceval.callsim);
Sk.misceval.apply=function(a,b,c,d,e){if(null===a||a instanceof Sk.builtin.none)throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not callable");if("function"===typeof a){if(a.sk$klass)return a.apply(null,[b,c,d,e]);if(c){c=c.tp$iter();for(var f=c.tp$iternext();void 0!==f;f=c.tp$iternext())e.push(f)}b&&goog.asserts.fail("kwdict not implemented;");goog.asserts.assert(void 0===d||0===d.length);return a.apply(null,e)}var g=a.tp$call;if(void 0!==g){if(c)for(c=c.tp$iter(),f=c.tp$iternext();void 0!==
f;f=c.tp$iternext())e.push(f);b&&goog.asserts.fail("kwdict not implemented;");return g.call(a,e,d,b)}g=a.__call__;if(void 0!==g)return e.unshift(a),Sk.misceval.apply(g,d,e,b,c);throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not callable");};goog.exportSymbol("Sk.misceval.apply",Sk.misceval.apply);Sk.misceval.buildClass=function(a,b,c,d){var e=Sk.builtin.type,f={};b(a,f,[]);f.__module__=a.__name__;return Sk.misceval.callsim(e,c,d,f)};
goog.exportSymbol("Sk.misceval.buildClass",Sk.misceval.buildClass);Sk.abstr={};Sk.abstr.typeName=function(a){return a instanceof Sk.builtin.nmber?a.skType:void 0!==a.tp$name?a.tp$name:"<invalid type>"};Sk.abstr.binop_type_error=function(a,b,c){a=Sk.abstr.typeName(a);b=Sk.abstr.typeName(b);throw new Sk.builtin.TypeError("unsupported operand type(s) for "+c+": '"+a+"' and '"+b+"'");};
Sk.abstr.boNameToSlotFuncLhs_=function(a,b){if(null!==a)switch(b){case "Add":return a.nb$add?a.nb$add:a.__add__;case "Sub":return a.nb$subtract?a.nb$subtract:a.__sub__;case "Mult":return a.nb$multiply?a.nb$multiply:a.__mul__;case "Div":return a.nb$divide?a.nb$divide:a.__div__;case "FloorDiv":return a.nb$floor_divide?a.nb$floor_divide:a.__floordiv__;case "Mod":return a.nb$remainder?a.nb$remainder:a.__mod__;case "Pow":return a.nb$power?a.nb$power:a.__pow__;case "LShift":return a.nb$lshift?a.nb$lshift:
a.__lshift__;case "RShift":return a.nb$rshift?a.nb$rshift:a.__rshift__;case "BitAnd":return a.nb$and?a.nb$and:a.__and__;case "BitXor":return a.nb$xor?a.nb$xor:a.__xor__;case "BitOr":return a.nb$or?a.nb$or:a.__or__}};
Sk.abstr.boNameToSlotFuncRhs_=function(a,b){if(null!==a)switch(b){case "Add":return a.nb$add?a.nb$add:a.__radd__;case "Sub":return a.nb$subtract?a.nb$subtract:a.__rsub__;case "Mult":return a.nb$multiply?a.nb$multiply:a.__rmul__;case "Div":return a.nb$divide?a.nb$divide:a.__rdiv__;case "FloorDiv":return a.nb$floor_divide?a.nb$floor_divide:a.__rfloordiv__;case "Mod":return a.nb$remainder?a.nb$remainder:a.__rmod__;case "Pow":return a.nb$power?a.nb$power:a.__rpow__;case "LShift":return a.nb$lshift?a.nb$lshift:
a.__rlshift__;case "RShift":return a.nb$rshift?a.nb$rshift:a.__rrshift__;case "BitAnd":return a.nb$and?a.nb$and:a.__rand__;case "BitXor":return a.nb$xor?a.nb$xor:a.__rxor__;case "BitOr":return a.nb$or?a.nb$or:a.__ror__}};
Sk.abstr.iboNameToSlotFunc_=function(a,b){switch(b){case "Add":return a.nb$inplace_add?a.nb$inplace_add:a.__iadd__;case "Sub":return a.nb$inplace_subtract?a.nb$inplace_subtract:a.__isub__;case "Mult":return a.nb$inplace_multiply?a.nb$inplace_multiply:a.__imul__;case "Div":return a.nb$inplace_divide?a.nb$inplace_divide:a.__idiv__;case "FloorDiv":return a.nb$inplace_floor_divide?a.nb$inplace_floor_divide:a.__ifloordiv__;case "Mod":return a.nb$inplace_remainder;case "Pow":return a.nb$inplace_power;case "LShift":return a.nb$inplace_lshift?
a.nb$inplace_lshift:a.__ilshift__;case "RShift":return a.nb$inplace_rshift?a.nb$inplace_rshift:a.__irshift__;case "BitAnd":return a.nb$inplace_and;case "BitOr":return a.nb$inplace_or;case "BitXor":return a.nb$inplace_xor?a.nb$inplace_xor:a.__ixor__}};
Sk.abstr.binary_op_=function(a,b,c){var d;d=Sk.abstr.boNameToSlotFuncLhs_(a,c);if(void 0!==d&&(d=d.call?d.call(a,b):Sk.misceval.callsim(d,a,b),void 0!==d))return d;d=Sk.abstr.boNameToSlotFuncRhs_(b,c);if(void 0!==d&&(d=d.call?d.call(b,a):Sk.misceval.callsim(d,b,a),void 0!==d))return d;Sk.abstr.binop_type_error(a,b,c)};
Sk.abstr.binary_iop_=function(a,b,c){var d;d=Sk.abstr.iboNameToSlotFunc_(a,c);if(void 0!==d&&(d=d.call?d.call(a,b):Sk.misceval.callsim(d,a,b),void 0!==d))return d;d=Sk.abstr.iboNameToSlotFunc_(b,c);if(void 0!==d&&(d=d.call?d.call(b,a):Sk.misceval.callsim(d,b,a),void 0!==d))return d;Sk.abstr.binop_type_error(a,b,c)};
Sk.abstr.numOpAndPromote=function(a,b,c){if(null!==a&&null!==b){if("number"===typeof a&&"number"===typeof b)return c=c(a,b),(c>Sk.builtin.lng.threshold$||c<-Sk.builtin.lng.threshold$)&&Math.floor(c)===c?[Sk.builtin.lng.fromInt$(a),Sk.builtin.lng.fromInt$(b)]:c;if(void 0===a||void 0===b)throw new Sk.builtin.NameError("Undefined variable in expression");if(a.constructor===Sk.builtin.lng||a.constructor===Sk.builtin.nmber)return[a,b];if("number"===typeof a)return[new Sk.builtin.nmber(a,void 0),b]}};
Sk.abstr.boNumPromote_={Add:function(a,b){return a+b},Sub:function(a,b){return a-b},Mult:function(a,b){return a*b},Mod:function(a,b){if(0===b)throw new Sk.builtin.ZeroDivisionError("division or modulo by zero");var c=a%b;return 0>c*b?c+b:c},Div:function(a,b){if(0===b)throw new Sk.builtin.ZeroDivisionError("division or modulo by zero");return a/b},FloorDiv:function(a,b){if(0===b)throw new Sk.builtin.ZeroDivisionError("division or modulo by zero");return Math.floor(a/b)},Pow:Math.pow,BitAnd:function(a,
b){var c=a&b;0>c&&(c+=4294967296);return c},BitOr:function(a,b){var c=a|b;0>c&&(c+=4294967296);return c},BitXor:function(a,b){var c=a^b;0>c&&(c+=4294967296);return c},LShift:function(a,b){if(0>b)throw new Sk.builtin.ValueError("negative shift count");var c=a<<b;return c>a?c:a*Math.pow(2,b)},RShift:function(a,b){if(0>b)throw new Sk.builtin.ValueError("negative shift count");var c=a>>b;0<a&&0>c&&(c&=Math.pow(2,32-b)-1);return c}};
Sk.abstr.numberBinOp=function(a,b,c){var d=Sk.abstr.boNumPromote_[c];if(void 0!==d){d=Sk.abstr.numOpAndPromote(a,b,d);if("number"===typeof d)return d;if(void 0!==d&&d.constructor===Sk.builtin.nmber||void 0!==d&&d.constructor===Sk.builtin.lng)return d;void 0!==d&&(a=d[0],b=d[1])}return Sk.abstr.binary_op_(a,b,c)};goog.exportSymbol("Sk.abstr.numberBinOp",Sk.abstr.numberBinOp);
Sk.abstr.numberInplaceBinOp=function(a,b,c){var d=Sk.abstr.boNumPromote_[c];if(void 0!==d){d=Sk.abstr.numOpAndPromote(a,b,d);if("number"===typeof d)return d;if(void 0!==d&&d.constructor===Sk.builtin.nmber||void 0!==d&&d.constructor===Sk.builtin.lng)return d;void 0!==d&&(a=d[0],b=d[1])}return Sk.abstr.binary_iop_(a,b,c)};goog.exportSymbol("Sk.abstr.numberInplaceBinOp",Sk.abstr.numberInplaceBinOp);
Sk.abstr.numberUnaryOp=function(a,b){if("Not"===b)return Sk.misceval.isTrue(a)?Sk.builtin.bool.false$:Sk.builtin.bool.true$;if(a instanceof Sk.builtin.nmber||a instanceof Sk.builtin.bool){var c=Sk.builtin.asnum$(a);if("USub"===b)return new Sk.builtin.nmber(-c,c.skType);if("UAdd"===b)return new Sk.builtin.nmber(c,c.skType);if("Invert"===b)return new Sk.builtin.nmber(~c,c.skType)}else{if("USub"===b&&a.nb$negative)return a.nb$negative();if("UAdd"===b&&a.nb$positive)return a.nb$positive();if("Invert"===
b&&a.nb$invert)return a.nb$invert()}c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("unsupported operand type for "+b+" '"+c+"'");};goog.exportSymbol("Sk.abstr.numberUnaryOp",Sk.abstr.numberUnaryOp);Sk.abstr.fixSeqIndex_=function(a,b){b=Sk.builtin.asnum$(b);0>b&&a.sq$length&&(b+=a.sq$length());return b};
Sk.abstr.sequenceContains=function(a,b){if(a.sq$contains)return a.sq$contains(b);var c=Sk.abstr.typeName(a);if(!a.tp$iter)throw new Sk.builtin.TypeError("argument of type '"+c+"' is not iterable");for(var c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())if(Sk.misceval.richCompareBool(d,b,"Eq"))return!0;return!1};Sk.abstr.sequenceGetItem=function(a,b){goog.asserts.fail()};Sk.abstr.sequenceSetItem=function(a,b,c){goog.asserts.fail()};
Sk.abstr.sequenceDelItem=function(a,b){if(a.sq$del_item)b=Sk.abstr.fixSeqIndex_(a,b),a.sq$del_item(b);else{var c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+c+"' object does not support item deletion");}};Sk.abstr.sequenceRepeat=function(a,b,c){c=Sk.builtin.asnum$(c);if(void 0===Sk.misceval.asIndex(c))throw a=Sk.abstr.typeName(c),new Sk.builtin.TypeError("can't multiply sequence by non-int of type '"+a+"'");return a.call(b,c)};
Sk.abstr.sequenceGetSlice=function(a,b,c){if(a.sq$slice)return b=Sk.abstr.fixSeqIndex_(a,b),c=Sk.abstr.fixSeqIndex_(a,c),a.sq$slice(b,c);if(a.mp$subscript)return a.mp$subscript(new Sk.builtin.slice(b,c));a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' object is unsliceable");};
Sk.abstr.sequenceDelSlice=function(a,b,c){if(a.sq$del_slice)b=Sk.abstr.fixSeqIndex_(a,b),c=Sk.abstr.fixSeqIndex_(a,c),a.sq$del_slice(b,c);else throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("'"+a+"' doesn't support slice deletion");};
Sk.abstr.sequenceSetSlice=function(a,b,c,d){if(a.sq$ass_slice)b=Sk.abstr.fixSeqIndex_(a,b),c=Sk.abstr.fixSeqIndex_(a,c),a.sq$ass_slice(b,c,d);else if(a.mp$ass_subscript)a.mp$ass_subscript(new Sk.builtin.slice(b,c),d);else throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("'"+a+"' object doesn't support slice assignment");};
Sk.abstr.objectDelItem=function(a,b){if(null!==a){if(a.mp$del_subscript){a.mp$del_subscript(b);return}if(a.sq$ass_item){var c=Sk.misceval.asIndex(b);if(void 0===c)throw c=Sk.abstr.typeName(b),new Sk.builtin.TypeError("sequence index must be integer, not '"+c+"'");Sk.abstr.sequenceDelItem(a,c);return}}c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+c+"' object does not support item deletion");};goog.exportSymbol("Sk.abstr.objectDelItem",Sk.abstr.objectDelItem);
Sk.abstr.objectGetItem=function(a,b){if(null!==a){if(a.mp$subscript)return a.mp$subscript(b);if(Sk.misceval.isIndex(b)&&a.sq$item)return Sk.abstr.sequenceGetItem(a,Sk.misceval.asIndex(b));if(a.tp$getitem)return a.tp$getitem(b)}var c=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+c+"' does not support indexing");};goog.exportSymbol("Sk.abstr.objectGetItem",Sk.abstr.objectGetItem);
Sk.abstr.objectSetItem=function(a,b,c){if(null!==a){if(a.mp$ass_subscript)return a.mp$ass_subscript(b,c);if(Sk.misceval.isIndex(b)&&a.sq$ass_item)return Sk.abstr.sequenceSetItem(a,Sk.misceval.asIndex(b),c);if(a.tp$setitem)return a.tp$setitem(b,c)}a=Sk.abstr.typeName(a);throw new Sk.builtin.TypeError("'"+a+"' does not support item assignment");};goog.exportSymbol("Sk.abstr.objectSetItem",Sk.abstr.objectSetItem);
Sk.abstr.gattr=function(a,b){var c=Sk.abstr.typeName(a);if(null===a)throw new Sk.builtin.AttributeError("'"+c+"' object has no attribute '"+b+"'");var d=void 0;a.__getattr__?d=Sk.misceval.callsim(a.__getattr__,a,b):void 0!==a.tp$getattr&&(d=a.tp$getattr(b));if(void 0===d)throw new Sk.builtin.AttributeError("'"+c+"' object has no attribute '"+b+"'");return d};goog.exportSymbol("Sk.abstr.gattr",Sk.abstr.gattr);
Sk.abstr.sattr=function(a,b,c){var d=Sk.abstr.typeName(a);if(null===a)throw new Sk.builtin.AttributeError("'"+d+"' object has no attribute '"+b+"'");if(a.__setattr__)Sk.misceval.callsim(a.__setattr__,a,b,c);else if(void 0!==a.tp$setattr)a.tp$setattr(b,c);else throw new Sk.builtin.AttributeError("'"+d+"' object has no attribute '"+b+"'");};goog.exportSymbol("Sk.abstr.sattr",Sk.abstr.sattr);
Sk.abstr.iter=function(a){if(a.tp$iter)return a.tp$iter();throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");};goog.exportSymbol("Sk.abstr.iter",Sk.abstr.iter);Sk.abstr.iternext=function(a){return a.tp$iternext()};goog.exportSymbol("Sk.abstr.iternext",Sk.abstr.iternext);Sk.mergeSort=function(a,b,c,d){Sk.quickSort(a,b,c,d)};Sk.quickSort=function(a,b,c,d){goog.asserts.assert(!c,"todo;");b||(b=Sk.mergeSort.stdCmp);var e=function(a,c,d,k){if(d-1>c){var l=c+Math.floor(Math.random()*(d-c)),m,n=a[l];m=a[l];a[l]=a[d-1];a[d-1]=m;var l=c,p;for(p=c;p<d-1;++p)m=k?Sk.misceval.callsim(b,n,a[p]):Sk.misceval.callsim(b,a[p],n),0>Sk.builtin.asnum$(m)&&(m=a[l],a[l]=a[p],a[p]=m,++l);m=a[d-1];a[d-1]=a[l];a[l]=m;e(a,c,l,k);e(a,l+1,d,k)}};e(a,0,a.length,d);return null};
Sk.mergeSort.stdCmp=new Sk.builtin.func(function(a,b){return Sk.misceval.richCompareBool(a,b,"Lt")?-1:0});Sk.builtin.list=function(a){if(!(this instanceof Sk.builtin.list))return new Sk.builtin.list(a);if(void 0===a)this.v=[];else if("[object Array]"===Object.prototype.toString.apply(a))this.v=a;else if(a.tp$iter){this.v=[];a=a.tp$iter();for(var b=a.tp$iternext();void 0!==b;b=a.tp$iternext())this.v.push(b)}else throw new Sk.builtin.ValueError("expecting Array or iterable");this.__class__=Sk.builtin.list;this.v=this.v;return this};
Sk.builtin.list.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("list",Sk.builtin.list);Sk.builtin.list.prototype.list_iter_=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){return a.$index>=a.$obj.v.length?void 0:a.$obj.v[a.$index++]}};return a};
Sk.builtin.list.prototype.list_concat_=function(a){if(!a.__class__||a.__class__!=Sk.builtin.list)throw new Sk.builtin.TypeError("can only concatenate list to list");for(var b=this.v.slice(),c=0;c<a.v.length;++c)b.push(a.v[c]);return new Sk.builtin.list(b)};Sk.builtin.list.prototype.list_del_item_=function(a){a=Sk.builtin.asnum$(a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("list assignment index out of range");this.list_del_slice_(a,a+1)};
Sk.builtin.list.prototype.list_del_slice_=function(a,b){a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);var c=[];c.unshift(b-a);c.unshift(a);this.v.splice.apply(this.v,c)};Sk.builtin.list.prototype.list_ass_item_=function(a,b){a=Sk.builtin.asnum$(a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("list assignment index out of range");this.v[a]=b};
Sk.builtin.list.prototype.list_ass_slice_=function(a,b,c){a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);c=c.v.slice(0);c.unshift(b-a);c.unshift(a);this.v.splice.apply(this.v,c)};Sk.builtin.list.prototype.tp$name="list";Sk.builtin.list.prototype.$r=function(){for(var a=[],b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())a.push(Sk.misceval.objectRepr(c).v);return new Sk.builtin.str("["+a.join(", ")+"]")};Sk.builtin.list.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;
Sk.builtin.list.prototype.tp$hash=Sk.builtin.object.prototype.HashNotImplemented;
Sk.builtin.list.prototype.tp$richcompare=function(a,b){if(this===a&&Sk.misceval.opAllowsEquality(b))return!0;if(!a.__class__||a.__class__!=Sk.builtin.list)return"Eq"===b?!1:"NotEq"===b?!0:!1;var c=this.v;a=a.v;var d=c.length,e=a.length,f;for(f=0;f<d&&f<e&&Sk.misceval.richCompareBool(c[f],a[f],"Eq");++f);if(f>=d||f>=e)switch(b){case "Lt":return d<e;case "LtE":return d<=e;case "Eq":return d===e;case "NotEq":return d!==e;case "Gt":return d>e;case "GtE":return d>=e;default:goog.asserts.fail()}return"Eq"===
b?!1:"NotEq"===b?!0:Sk.misceval.richCompareBool(c[f],a[f],b)};Sk.builtin.list.prototype.tp$iter=Sk.builtin.list.prototype.list_iter_;Sk.builtin.list.prototype.sq$length=function(){return this.v.length};Sk.builtin.list.prototype.sq$concat=Sk.builtin.list.prototype.list_concat_;Sk.builtin.list.prototype.nb$add=Sk.builtin.list.prototype.list_concat_;Sk.builtin.list.prototype.nb$inplace_add=Sk.builtin.list.prototype.list_concat_;
Sk.builtin.list.prototype.sq$repeat=function(a){a=Sk.builtin.asnum$(a);for(var b=[],c=0;c<a;++c)for(var d=0;d<this.v.length;++d)b.push(this.v[d]);return new Sk.builtin.list(b)};Sk.builtin.list.prototype.nb$multiply=Sk.builtin.list.prototype.sq$repeat;Sk.builtin.list.prototype.nb$inplace_multiply=Sk.builtin.list.prototype.sq$repeat;Sk.builtin.list.prototype.sq$ass_item=Sk.builtin.list.prototype.list_ass_item_;Sk.builtin.list.prototype.sq$del_item=Sk.builtin.list.prototype.list_del_item_;
Sk.builtin.list.prototype.sq$ass_slice=Sk.builtin.list.prototype.list_ass_slice_;Sk.builtin.list.prototype.sq$del_slice=Sk.builtin.list.prototype.list_del_slice_;
Sk.builtin.list.prototype.list_subscript_=function(a){if(Sk.misceval.isIndex(a)){var b=Sk.misceval.asIndex(a);if(void 0!==b){0>b&&(b=this.v.length+b);if(0>b||b>=this.v.length)throw new Sk.builtin.IndexError("list index out of range");return this.v[b]}}else if(a instanceof Sk.builtin.slice){var c=[];a.sssiter$(this,function(a,b){c.push(b.v[a])});return new Sk.builtin.list(c)}throw new Sk.builtin.TypeError("list indices must be integers, not "+Sk.abstr.typeName(a));};
Sk.builtin.list.prototype.list_ass_subscript_=function(a,b){if(Sk.misceval.isIndex(a)){var c=Sk.misceval.asIndex(a);if(void 0!==c){0>c&&(c=this.v.length+c);this.list_ass_item_(c,b);return}}else if(a instanceof Sk.builtin.slice){if(1===(null!==a.step?a.step:1))this.list_ass_slice_(a.start,a.stop,b);else{var d=[];a.sssiter$(this,function(a,b){d.push(a)});var e=0;if(d.length!==b.v.length)throw new Sk.builtin.ValueError("attempt to assign sequence of size "+b.v.length+" to extended slice of size "+d.length);
for(c=0;c<d.length;++c)this.v.splice(d[c],1,b.v[e]),e+=1}return}throw new Sk.builtin.TypeError("list indices must be integers, not "+Sk.abstr.typeName(a));};
Sk.builtin.list.prototype.list_del_subscript_=function(a){if(Sk.misceval.isIndex(a)){var b=Sk.misceval.asIndex(a);if(void 0!==b){0>b&&(b=this.v.length+b);this.list_del_item_(b);return}}else if(a instanceof Sk.builtin.slice){if(1===a.step)this.list_del_slice_(a.start,a.stop);else{var c=this,d=0,e=0<(null===a.step?1:a.step)?1:0;a.sssiter$(this,function(a,b){c.v.splice(a-d,1);d+=e})}return}throw new Sk.builtin.TypeError("list indices must be integers, not "+typeof a);};
Sk.builtin.list.prototype.mp$subscript=Sk.builtin.list.prototype.list_subscript_;Sk.builtin.list.prototype.mp$ass_subscript=Sk.builtin.list.prototype.list_ass_subscript_;Sk.builtin.list.prototype.mp$del_subscript=Sk.builtin.list.prototype.list_del_subscript_;Sk.builtin.list.prototype.__getitem__=new Sk.builtin.func(function(a,b){return Sk.builtin.list.prototype.list_subscript_.call(a,b)});
Sk.builtin.list.prototype.list_sort_=function(a,b,c,d){var e=void 0!==c&&null!==c,f=void 0!==b&&null!==b;void 0==d&&(d=!1);var g=new Sk.builtin.timSort(a);a.v=[];var h=new Sk.builtin.nmber(0,Sk.builtin.nmber.int$);if(e){g.lt=f?function(a,c){return Sk.misceval.richCompareBool(b.func_code(a[0],c[0]),h,"Lt")}:function(a,b){return Sk.misceval.richCompareBool(a[0],b[0],"Lt")};for(var k=0;k<g.listlength;k++){var f=g.list.v[k],l=c.func_code(f);g.list.v[k]=[l,f]}}else f&&(g.lt=function(a,c){return Sk.misceval.richCompareBool(b.func_code(a,
c),h,"Lt")});d&&g.list.list_reverse_(g.list);g.sort();d&&g.list.list_reverse_(g.list);if(e)for(c=0;c<g.listlength;c++)f=g.list.v[c][1],g.list.v[c]=f;c=0<a.sq$length();a.v=g.list.v;if(c)throw new Sk.builtin.OperationError("list modified during sort");return Sk.builtin.none.none$};Sk.builtin.list.prototype.list_reverse_=function(a){Sk.builtin.pyCheckArgs("reverse",arguments,1,1);for(var b=a.v,c=[],d=a.v.length-1;-1<d;--d)c.push(b[d]);a.v=c;return Sk.builtin.none.none$};
Sk.builtin.list.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,1,1);return a.list_iter_()});Sk.builtin.list.prototype.append=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("append",arguments,2,2);a.v.push(b);return Sk.builtin.none.none$});
Sk.builtin.list.prototype.insert=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("insert",arguments,3,3);if(!Sk.builtin.checkNumber(b))throw new Sk.builtin.TypeError("an integer is required");b=Sk.builtin.asnum$(b);0>b?b=0:b>a.v.length&&(b=a.v.length);a.v.splice(b,0,c);return Sk.builtin.none.none$});
Sk.builtin.list.prototype.extend=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("extend",arguments,2,2);if(!Sk.builtin.checkIterable(b))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object is not iterable");if(a==b){for(var c=[],d=b.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())c.push(e);a.v.push.apply(a.v,c);return Sk.builtin.none.none$}d=b.tp$iter();for(e=d.tp$iternext();void 0!==e;e=d.tp$iternext())a.v.push(e);return Sk.builtin.none.none$});
Sk.builtin.list.prototype.pop=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("pop",arguments,1,2);void 0===b&&(b=a.v.length-1);if(!Sk.builtin.checkNumber(b))throw new Sk.builtin.TypeError("an integer is required");b=Sk.builtin.asnum$(b);if(0>b||b>=a.v.length)throw new Sk.builtin.IndexError("pop index out of range");var c=a.v[b];a.v.splice(b,1);return c});
Sk.builtin.list.prototype.remove=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("remove",arguments,2,2);var c=Sk.builtin.list.prototype.index.func_code(a,b);a.v.splice(Sk.builtin.asnum$(c),1);return Sk.builtin.none.none$});
Sk.builtin.list.prototype.index=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("index",arguments,2,2);for(var c=a.v.length,d=a.v,e=0;e<c;++e)if(Sk.misceval.richCompareBool(d[e],b,"Eq"))return Sk.builtin.assk$(e,Sk.builtin.nmber.int$);throw new Sk.builtin.ValueError("list.index(x): x not in list");});
Sk.builtin.list.prototype.count=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("count",arguments,2,2);for(var c=a.v.length,d=a.v,e=0,f=0;f<c;++f)Sk.misceval.richCompareBool(d[f],b,"Eq")&&(e+=1);return new Sk.builtin.nmber(e,Sk.builtin.nmber.int$)});Sk.builtin.list.prototype.reverse=new Sk.builtin.func(Sk.builtin.list.prototype.list_reverse_);Sk.builtin.list.prototype.sort=new Sk.builtin.func(Sk.builtin.list.prototype.list_sort_);
Sk.builtin.list.prototype.sort.func_code.co_varnames=["__self__","cmp","key","reverse"];goog.exportSymbol("Sk.builtin.list",Sk.builtin.list);var interned={};
Sk.builtin.str=function(a){void 0===a&&(a="");if(a instanceof Sk.builtin.str&&a!==Sk.builtin.str.prototype.ob$type)return a;if(!(this instanceof Sk.builtin.str))return new Sk.builtin.str(a);if(!0===a)a="True";else if(!1===a)a="False";else if(null===a||a instanceof Sk.builtin.none)a="None";else if(a instanceof Sk.builtin.bool)a=a.v?"True":"False";else if("number"===typeof a)a=a.toString(),"Infinity"===a?a="inf":"-Infinity"===a&&(a="-inf");else if("string"!==typeof a){if(void 0!==a.tp$str){a=a.tp$str();
if(!(a instanceof Sk.builtin.str))throw new Sk.builtin.ValueError("__str__ didn't return a str");return a}return Sk.misceval.objectRepr(a)}if(Object.prototype.hasOwnProperty.call(interned,"1"+a))return interned["1"+a];this.__class__=Sk.builtin.str;this.v=this.v=a;interned["1"+a]=this;return this};goog.exportSymbol("Sk.builtin.str",Sk.builtin.str);Sk.builtin.str.$emptystr=new Sk.builtin.str("");
Sk.builtin.str.prototype.mp$subscript=function(a){a=Sk.builtin.asnum$(a);if("number"===typeof a&&Math.floor(a)===a){0>a&&(a=this.v.length+a);if(0>a||a>=this.v.length)throw new Sk.builtin.IndexError("string index out of range");return new Sk.builtin.str(this.v.charAt(a))}if(a instanceof Sk.builtin.slice){var b="";a.sssiter$(this,function(a,d){0<=a&&a<d.v.length&&(b+=d.v.charAt(a))});return new Sk.builtin.str(b)}throw new Sk.builtin.TypeError("string indices must be numbers, not "+typeof a);};
Sk.builtin.str.prototype.sq$length=function(){return this.v.length};Sk.builtin.str.prototype.sq$concat=function(a){if(!a||!Sk.builtin.checkString(a))throw a=Sk.abstr.typeName(a),new Sk.builtin.TypeError("cannot concatenate 'str' and '"+a+"' objects");return new Sk.builtin.str(this.v+a.v)};Sk.builtin.str.prototype.nb$add=Sk.builtin.str.prototype.sq$concat;Sk.builtin.str.prototype.nb$inplace_add=Sk.builtin.str.prototype.sq$concat;
Sk.builtin.str.prototype.sq$repeat=function(a){a=Sk.builtin.asnum$(a);for(var b="",c=0;c<a;++c)b+=this.v;return new Sk.builtin.str(b)};Sk.builtin.str.prototype.nb$multiply=Sk.builtin.str.prototype.sq$repeat;Sk.builtin.str.prototype.nb$inplace_multiply=Sk.builtin.str.prototype.sq$repeat;Sk.builtin.str.prototype.sq$item=function(){goog.asserts.fail()};
Sk.builtin.str.prototype.sq$slice=function(a,b){a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);0>a&&(a=0);return new Sk.builtin.str(this.v.substr(a,b-a))};Sk.builtin.str.prototype.sq$contains=function(a){if(void 0===a.v||a.v.constructor!=String)throw new Sk.builtin.TypeError("TypeError: 'In <string> requires string as left operand");return-1!=this.v.indexOf(a.v)?!0:!1};Sk.builtin.str.prototype.tp$name="str";Sk.builtin.str.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;
Sk.builtin.str.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){return a.$index>=a.$obj.v.length?void 0:new Sk.builtin.str(a.$obj.v.substr(a.$index++,1))}};return a};
Sk.builtin.str.prototype.tp$richcompare=function(a,b){if(a instanceof Sk.builtin.str){if(this===a)switch(b){case "Eq":case "LtE":case "GtE":return!0;case "NotEq":case "Lt":case "Gt":return!1}var c=this.v.length,d=a.v.length,e=Math.min(c,d),f=0;if(0<e)for(var g=0;g<e;++g){if(this.v[g]!=a.v[g]){f=this.v[g].charCodeAt(0)-a.v[g].charCodeAt(0);break}}else f=0;0==f&&(f=c<d?-1:c>d?1:0);switch(b){case "Lt":return 0>f;case "LtE":return 0>=f;case "Eq":return 0==f;case "NotEq":return 0!=f;case "Gt":return 0<
f;case "GtE":return 0<=f;default:goog.asserts.fail()}}};Sk.builtin.str.prototype.$r=function(){var a="'";-1!==this.v.indexOf("'")&&-1===this.v.indexOf('"')&&(a='"');for(var b=this.v.length,c=a,d=0;d<b;++d){var e=this.v.charAt(d);e===a||"\\"===e?c+="\\"+e:"\t"===e?c+="\\t":"\n"===e?c+="\\n":"\r"===e?c+="\\r":" ">e||127<=e?(e=e.charCodeAt(0).toString(16),2>e.length&&(e="0"+e),c+="\\x"+e):c+=e}return new Sk.builtin.str(c+a)};
Sk.builtin.str.re_escape_=function(a){for(var b=[],c=/^[A-Za-z0-9]+$/,d=0;d<a.length;++d){var e=a.charAt(d);c.test(e)?b.push(e):"\\000"===e?b.push("\\000"):b.push("\\"+e)}return b.join("")};Sk.builtin.str.prototype.lower=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("lower",arguments,1,1);return new Sk.builtin.str(a.v.toLowerCase())});Sk.builtin.str.prototype.upper=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("upper",arguments,1,1);return new Sk.builtin.str(a.v.toUpperCase())});
Sk.builtin.str.prototype.capitalize=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("capitalize",arguments,1,1);var b=a.v,c,d;if(0===b.length)return new Sk.builtin.str("");c=b.charAt(0).toUpperCase();for(d=1;d<b.length;d++)c+=b.charAt(d).toLowerCase();return new Sk.builtin.str(c)});
Sk.builtin.str.prototype.join=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("join",arguments,2,2);Sk.builtin.pyCheckType("seq","iterable",Sk.builtin.checkIterable(b));for(var c=[],d=b.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext()){if(e.constructor!==Sk.builtin.str)throw"TypeError: sequence item "+c.length+": expected string, "+typeof e+" found";c.push(e.v)}return new Sk.builtin.str(c.join(a.v))});
Sk.builtin.str.prototype.split=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("split",arguments,1,3);if(void 0===b||b instanceof Sk.builtin.none)b=null;if(null!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a string");if(null!==b&&""===b.v)throw new Sk.builtin.ValueError("empty separator");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("an integer is required");c=Sk.builtin.asnum$(c);var d=/[\s]+/g,e=a.v;null===b?e=e.trimLeft():(d=b.v.replace(/([.*+?=|\\\/()\[\]\{\}^$])/g,
"\\$1"),d=RegExp(d,"g"));for(var f=[],g,h=0,k=0;null!=(g=d.exec(e))&&g.index!==d.lastIndex&&!(f.push(new Sk.builtin.str(e.substring(h,g.index))),h=d.lastIndex,k+=1,c&&k>=c););e=e.substring(h);(null!==b||0<e.length)&&f.push(new Sk.builtin.str(e));return new Sk.builtin.list(f)});
Sk.builtin.str.prototype.strip=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("strip",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("strip arg must be None or str");var c;void 0===b?c=/^\s+|\s+$/g:(c=Sk.builtin.str.re_escape_(b.v),c=RegExp("^["+c+"]+|["+c+"]+$","g"));return new Sk.builtin.str(a.v.replace(c,""))});
Sk.builtin.str.prototype.lstrip=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("lstrip",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("lstrip arg must be None or str");var c;void 0===b?c=/^\s+/g:(c=Sk.builtin.str.re_escape_(b.v),c=RegExp("^["+c+"]+","g"));return new Sk.builtin.str(a.v.replace(c,""))});
Sk.builtin.str.prototype.rstrip=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("rstrip",arguments,1,2);if(void 0!==b&&!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("rstrip arg must be None or str");var c;void 0===b?c=/\s+$/g:(c=Sk.builtin.str.re_escape_(b.v),c=RegExp("["+c+"]+$","g"));return new Sk.builtin.str(a.v.replace(c,""))});
Sk.builtin.str.prototype.partition=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("partition",arguments,2,2);Sk.builtin.pyCheckType("sep","string",Sk.builtin.checkString(b));var c=new Sk.builtin.str(b),d=a.v.indexOf(c.v);return 0>d?new Sk.builtin.tuple([a,Sk.builtin.str.$emptystr,Sk.builtin.str.$emptystr]):new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0,d)),c,new Sk.builtin.str(a.v.substring(d+c.v.length))])});
Sk.builtin.str.prototype.rpartition=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("rpartition",arguments,2,2);Sk.builtin.pyCheckType("sep","string",Sk.builtin.checkString(b));var c=new Sk.builtin.str(b),d=a.v.lastIndexOf(c.v);return 0>d?new Sk.builtin.tuple([Sk.builtin.str.$emptystr,Sk.builtin.str.$emptystr,a]):new Sk.builtin.tuple([new Sk.builtin.str(a.v.substring(0,d)),c,new Sk.builtin.str(a.v.substring(d+c.v.length))])});
Sk.builtin.str.prototype.count=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgs("count",arguments,2,4);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a character buffer object");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");void 0===
c?c=0:(c=Sk.builtin.asnum$(c),c=0<=c?c:a.v.length+c);void 0===d?d=a.v.length:(d=Sk.builtin.asnum$(d),d=0<=d?d:a.v.length+d);var e=RegExp(b.v,"g");return(e=a.v.slice(c,d).match(e))?new Sk.builtin.nmber(e.length,Sk.builtin.nmber.int$):new Sk.builtin.nmber(0,Sk.builtin.nmber.int$)});
Sk.builtin.str.prototype.ljust=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("ljust",arguments,2,3);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepcted, got "+Sk.abstr.typeName(b));if(void 0!==c&&(!Sk.builtin.checkString(c)||1!==c.v.length))throw new Sk.builtin.TypeError("must be char, not "+Sk.abstr.typeName(c));c=void 0===c?" ":c.v;b=Sk.builtin.asnum$(b);if(a.v.length>=b)return a;var d=Array.prototype.join.call({length:Math.floor(b-a.v.length)+1},c);
return new Sk.builtin.str(a.v+d)});
Sk.builtin.str.prototype.rjust=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("rjust",arguments,2,3);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepcted, got "+Sk.abstr.typeName(b));if(void 0!==c&&(!Sk.builtin.checkString(c)||1!==c.v.length))throw new Sk.builtin.TypeError("must be char, not "+Sk.abstr.typeName(c));c=void 0===c?" ":c.v;b=Sk.builtin.asnum$(b);if(a.v.length>=b)return a;var d=Array.prototype.join.call({length:Math.floor(b-a.v.length)+1},c);
return new Sk.builtin.str(d+a.v)});
Sk.builtin.str.prototype.center=new Sk.builtin.func(function(a,b,c){Sk.builtin.pyCheckArgs("center",arguments,2,3);if(!Sk.builtin.checkInt(b))throw new Sk.builtin.TypeError("integer argument exepcted, got "+Sk.abstr.typeName(b));if(void 0!==c&&(!Sk.builtin.checkString(c)||1!==c.v.length))throw new Sk.builtin.TypeError("must be char, not "+Sk.abstr.typeName(c));c=void 0===c?" ":c.v;b=Sk.builtin.asnum$(b);if(a.v.length>=b)return a;var d=Array.prototype.join.call({length:Math.floor((b-a.v.length)/2)+
1},c),d=d+a.v+d;d.length<b&&(d+=c);return new Sk.builtin.str(d)});
Sk.builtin.str.prototype.find=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgs("find",arguments,2,4);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a character buffer object");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");void 0===
c?c=0:(c=Sk.builtin.asnum$(c),c=0<=c?c:a.v.length+c);void 0===d?d=a.v.length:(d=Sk.builtin.asnum$(d),d=0<=d?d:a.v.length+d);var e=a.v.indexOf(b.v,c);return new Sk.builtin.nmber(e>=c&&e<d?e:-1,Sk.builtin.nmber.int$)});Sk.builtin.str.prototype.index=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgs("index",arguments,2,4);var e=Sk.misceval.callsim(a.find,a,b,c,d);if(-1===Sk.builtin.asnum$(e))throw new Sk.builtin.ValueError("substring not found");return e});
Sk.builtin.str.prototype.rfind=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgs("rfind",arguments,2,4);if(!Sk.builtin.checkString(b))throw new Sk.builtin.TypeError("expected a character buffer object");if(void 0!==c&&!Sk.builtin.checkInt(c))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("slice indices must be integers or None or have an __index__ method");void 0===
c?c=0:(c=Sk.builtin.asnum$(c),c=0<=c?c:a.v.length+c);void 0===d?d=a.v.length:(d=Sk.builtin.asnum$(d),d=0<=d?d:a.v.length+d);var e=a.v.lastIndexOf(b.v,d),e=e!==d?e:a.v.lastIndexOf(b.v,d-1);return new Sk.builtin.nmber(e>=c&&e<d?e:-1,Sk.builtin.nmber.int$)});Sk.builtin.str.prototype.rindex=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgs("rindex",arguments,2,4);var e=Sk.misceval.callsim(a.rfind,a,b,c,d);if(-1===Sk.builtin.asnum$(e))throw new Sk.builtin.ValueError("substring not found");return e});
Sk.builtin.str.prototype.startswith=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("startswith",arguments,2,2);Sk.builtin.pyCheckType("tgt","string",Sk.builtin.checkString(b));return Sk.builtin.bool(0==a.v.indexOf(b.v))});Sk.builtin.str.prototype.endswith=new Sk.builtin.func(function(a,b){Sk.builtin.pyCheckArgs("endswith",arguments,2,2);Sk.builtin.pyCheckType("tgt","string",Sk.builtin.checkString(b));return Sk.builtin.bool(-1!==a.v.indexOf(b.v,a.v.length-b.v.length))});
Sk.builtin.str.prototype.replace=new Sk.builtin.func(function(a,b,c,d){Sk.builtin.pyCheckArgs("replace",arguments,3,4);Sk.builtin.pyCheckType("oldS","string",Sk.builtin.checkString(b));Sk.builtin.pyCheckType("newS","string",Sk.builtin.checkString(c));if(void 0!==d&&!Sk.builtin.checkInt(d))throw new Sk.builtin.TypeError("integer argument expected, got "+Sk.abstr.typeName(d));d=Sk.builtin.asnum$(d);var e=RegExp(Sk.builtin.str.re_escape_(b.v),"g");if(void 0===d||0>d)return new Sk.builtin.str(a.v.replace(e,
c.v));var f=0;return new Sk.builtin.str(a.v.replace(e,function(a){f++;return f<=d?c.v:a}))});Sk.builtin.str.prototype.isdigit=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("isdigit",arguments,1,1);if(0===a.v.length)return Sk.builtin.bool(!1);var b;for(b=0;b<a.v.length;b++){var c=a.v.charAt(b);if("0">c||"9"<c)return Sk.builtin.bool(!1)}return Sk.builtin.bool(!0)});Sk.builtin.str.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("str",Sk.builtin.str);
Sk.builtin.str.prototype.nb$remainder=function(a){a.constructor===Sk.builtin.tuple||void 0!==a.mp$subscript&&a.constructor!==Sk.builtin.str||(a=new Sk.builtin.tuple([a]));var b=0,c=this.v.replace(/%(\([a-zA-Z0-9]+\))?([#0 +\-]+)?(\*|[0-9]+)?(\.(\*|[0-9]+))?[hlL]?([diouxXeEfFgGcrs%])/g,function(c,e,f,g,h,k,l){g=Sk.builtin.asnum$(g);h=Sk.builtin.asnum$(h);var m;if(void 0===e||""===e)m=b++;var n=!1,p=!1,q=!1,r=!1,s=!1;f&&(-1!==f.indexOf("-")?p=!0:-1!==f.indexOf("0")&&(n=!0),-1!==f.indexOf("+")?r=!0:
-1!==f.indexOf(" ")&&(q=!0),s=-1!==f.indexOf("#"));h&&(h=parseInt(h.substr(1),10));f=function(a,b){b=Sk.builtin.asnum$(b);var c,d,e=!1;"number"===typeof a?(0>a&&(a=-a,e=!0),d=a.toString(b)):a instanceof Sk.builtin.nmber?(d=a.str$(b,!1),2<d.length&&".0"===d.substr(-2)&&(d=d.substr(0,d.length-2)),e=a.nb$isnegative()):a instanceof Sk.builtin.lng&&(d=a.str$(b,!1),e=a.nb$isnegative());goog.asserts.assert(void 0!==d,"unhandled number format");var f=!1;if(h)for(c=d.length;c<h;++c)d="0"+d,f=!0;c="";e?c="-":
r?c="+"+c:q&&(c=" "+c);s&&(16===b?c+="0x":8!==b||(f||"0"===d)||(c+="0"));return[c,d]};c=function(a){var b=a[0];a=a[1];var c;if(g)if(g=parseInt(g,10),c=a.length+b.length,n)for(;c<g;++c)a="0"+a;else if(p)for(;c<g;++c)a+=" ";else for(;c<g;++c)b=" "+b;return b+a};if(a.constructor===Sk.builtin.tuple)e=a.v[m];else if(void 0!==a.mp$subscript)e=e.substring(1,e.length-1),e=a.mp$subscript(new Sk.builtin.str(e));else throw new Sk.builtin.AttributeError(a.tp$name+" instance has no attribute 'mp$subscript'");
switch(l){case "d":case "i":return c(f(e,10));case "o":return c(f(e,8));case "x":return c(f(e,16));case "X":return c(f(e,16)).toUpperCase();case "f":case "F":case "e":case "E":case "g":case "G":e=Sk.builtin.asnum$(e);"string"===typeof e&&(e=Number(e));if(Infinity===e)return"inf";if(-Infinity===e)return"-inf";if(isNaN(e))return"nan";m=["toExponential","toFixed","toPrecision"]["efg".indexOf(l.toLowerCase())];if(void 0===h||""===h)if("e"===l||"E"===l)h=6;else if("f"===l||"F"===l)h=7;e=e[m](h);-1!=="EFG".indexOf(l)&&
(e=e.toUpperCase());return c(["",e]);case "c":if("number"===typeof e)return String.fromCharCode(e);if(e instanceof Sk.builtin.nmber)return String.fromCharCode(e.v);if(e instanceof Sk.builtin.lng)return String.fromCharCode(e.str$(10,!1)[0]);if(e.constructor===Sk.builtin.str)return e.v.substr(0,1);throw new Sk.builtin.TypeError("an integer is required");case "r":return l=Sk.builtin.repr(e),h?l.v.substr(0,h):l.v;case "s":return l=new Sk.builtin.str(e),h?l.v.substr(0,h):l.v;case "%":return"%"}});return new Sk.builtin.str(c)};Sk.builtin.tuple=function(a){if(!(this instanceof Sk.builtin.tuple))return new Sk.builtin.tuple(a);void 0===a&&(a=[]);if("[object Array]"===Object.prototype.toString.apply(a))this.v=a;else if(a.tp$iter){this.v=[];a=a.tp$iter();for(var b=a.tp$iternext();void 0!==b;b=a.tp$iternext())this.v.push(b)}else throw new Sk.builtin.ValueError("expecting Array or iterable");this.__class__=Sk.builtin.tuple;this.v=this.v;return this};Sk.builtin.tuple.prototype.tp$name="tuple";
Sk.builtin.tuple.prototype.$r=function(){if(0===this.v.length)return new Sk.builtin.str("()");for(var a=[],b=0;b<this.v.length;++b)a[b]=Sk.misceval.objectRepr(this.v[b]).v;a=a.join(", ");1===this.v.length&&(a+=",");return new Sk.builtin.str("("+a+")")};
Sk.builtin.tuple.prototype.mp$subscript=function(a){if(Sk.misceval.isIndex(a)){var b=Sk.misceval.asIndex(a);if(void 0!==b){0>b&&(b=this.v.length+b);if(0>b||b>=this.v.length)throw new Sk.builtin.IndexError("tuple index out of range");return this.v[b]}}else if(a instanceof Sk.builtin.slice){var c=[];a.sssiter$(this,function(a,b){c.push(b.v[a])});return new Sk.builtin.tuple(c)}throw new Sk.builtin.TypeError("tuple indices must be integers, not "+Sk.abstr.typeName(a));};
Sk.builtin.tuple.prototype.tp$hash=function(){for(var a=1000003,b=3430008,c=this.v.length,d=0;d<c;++d){var e=Sk.builtin.hash(this.v[d]);if(-1===e)return-1;b=(b^e)*a;a+=82520+c+c}b+=97531;-1===b&&(b=-2);return b};Sk.builtin.tuple.prototype.sq$repeat=function(a){a=Sk.builtin.asnum$(a);for(var b=[],c=0;c<a;++c)for(var d=0;d<this.v.length;++d)b.push(this.v[d]);return new Sk.builtin.tuple(b)};Sk.builtin.tuple.prototype.nb$multiply=Sk.builtin.tuple.prototype.sq$repeat;
Sk.builtin.tuple.prototype.nb$inplace_multiply=Sk.builtin.tuple.prototype.sq$repeat;Sk.builtin.tuple.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("tuple",Sk.builtin.tuple);Sk.builtin.tuple.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,tp$iternext:function(){return a.$index>=a.$obj.v.length?void 0:a.$obj.v[a.$index++]}};return a};Sk.builtin.tuple.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,1,1);return a.tp$iter()});
Sk.builtin.tuple.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;
Sk.builtin.tuple.prototype.tp$richcompare=function(a,b){if(!a.__class__||a.__class__!=Sk.builtin.tuple)return"Eq"===b?!1:"NotEq"===b?!0:!1;var c=this.v;a=a.v;var d=c.length,e=a.length,f;for(f=0;f<d&&f<e&&Sk.misceval.richCompareBool(c[f],a[f],"Eq");++f);if(f>=d||f>=e)switch(b){case "Lt":return d<e;case "LtE":return d<=e;case "Eq":return d===e;case "NotEq":return d!==e;case "Gt":return d>e;case "GtE":return d>=e;default:goog.asserts.fail()}return"Eq"===b?!1:"NotEq"===b?!0:Sk.misceval.richCompareBool(c[f],
a[f],b)};Sk.builtin.tuple.prototype.sq$concat=function(a){return new Sk.builtin.tuple(this.v.concat(a.v))};Sk.builtin.tuple.prototype.nb$add=Sk.builtin.tuple.prototype.sq$concat;Sk.builtin.tuple.prototype.nb$inplace_add=Sk.builtin.tuple.prototype.sq$concat;Sk.builtin.tuple.prototype.sq$length=function(){return this.v.length};
Sk.builtin.tuple.prototype.index=new Sk.builtin.func(function(a,b){for(var c=a.v.length,d=a.v,e=0;e<c;++e)if(Sk.misceval.richCompareBool(d[e],b,"Eq"))return Sk.builtin.assk$(e,Sk.builtin.nmber.int$);throw new Sk.builtin.ValueError("tuple.index(x): x not in tuple");});Sk.builtin.tuple.prototype.count=new Sk.builtin.func(function(a,b){for(var c=a.v.length,d=a.v,e=0,f=0;f<c;++f)Sk.misceval.richCompareBool(d[f],b,"Eq")&&(e+=1);return new Sk.builtin.nmber(e,Sk.builtin.nmber.int$)});
goog.exportSymbol("Sk.builtin.tuple",Sk.builtin.tuple);Sk.builtin.dict=function(a){if(!(this instanceof Sk.builtin.dict))return new Sk.builtin.dict(a);void 0===a&&(a=[]);this.size=0;if("[object Array]"===Object.prototype.toString.apply(a))for(var b=0;b<a.length;b+=2)this.mp$ass_subscript(a[b],a[b+1]);else if(a instanceof Sk.builtin.dict)for(var c=a.tp$iter(),b=c.tp$iternext();void 0!==b;b=c.tp$iternext()){var d=a.mp$subscript(b);void 0===d&&(d=null);this.mp$ass_subscript(b,d)}else if(a.tp$iter)for(c=a.tp$iter(),b=c.tp$iternext();void 0!==b;b=c.tp$iternext())if(b.mp$subscript)this.mp$ass_subscript(b.mp$subscript(0),
b.mp$subscript(1));else throw new Sk.builtin.TypeError("element "+this.size+" is not a sequence");else throw new Sk.builtin.TypeError("object is not iterable");this.__class__=Sk.builtin.dict;return this};Sk.builtin.dict.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("dict",Sk.builtin.dict);var kf=Sk.builtin.hash;Sk.builtin.dict.prototype.key$lookup=function(a,b){var c,d,e;for(e=0;e<a.items.length;e++)if(c=a.items[e],d=Sk.misceval.richCompareBool(c.lhs,b,"Eq"))return c;return null};
Sk.builtin.dict.prototype.key$pop=function(a,b){var c,d,e;for(e=0;e<a.items.length;e++)if(c=a.items[e],d=Sk.misceval.richCompareBool(c.lhs,b,"Eq"))return a.items.splice(e,1),this.size-=1,c};Sk.builtin.dict.prototype.mp$lookup=function(a){var b=this[kf(a)];if(void 0!==b&&(a=this.key$lookup(b,a)))return a.rhs};Sk.builtin.dict.prototype.mp$subscript=function(a){var b=this.mp$lookup(a);if(void 0!==b)return b;a=new Sk.builtin.str(a);throw new Sk.builtin.KeyError(a.v);};
Sk.builtin.dict.prototype.sq$contains=function(a){return void 0!==this.mp$lookup(a)};Sk.builtin.dict.prototype.mp$ass_subscript=function(a,b){var c=kf(a),d=this[c];void 0===d?(d={$hash:c,items:[{lhs:a,rhs:b}]},this[c]=d,this.size+=1):(c=this.key$lookup(d,a))?c.rhs=b:(d.items.push({lhs:a,rhs:b}),this.size+=1)};Sk.builtin.dict.prototype.mp$del_subscript=function(a){var b=this[kf(a)];if(void 0!==b&&(b=this.key$pop(b,a),void 0!==b))return;a=new Sk.builtin.str(a);throw new Sk.builtin.KeyError(a.v);};
Sk.builtin.dict.prototype.tp$iter=function(){var a=[],b;for(b in this)if(this.hasOwnProperty(b)){var c=this[b];if(c&&void 0!==c.$hash)for(var d=0;d<c.items.length;d++)a.push(c.items[d].lhs)}var e={tp$iter:function(){return e},$obj:this,$index:0,$keys:a,tp$iternext:function(){return e.$index>=e.$keys.length?void 0:e.$keys[e.$index++]}};return e};Sk.builtin.dict.prototype.__iter__=new Sk.builtin.func(function(a){Sk.builtin.pyCheckArgs("__iter__",arguments,1,1);return a.tp$iter()});
Sk.builtin.dict.prototype.$r=function(){for(var a=[],b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext()){var d=this.mp$subscript(c);void 0===d&&(d=null);a.push(Sk.misceval.objectRepr(c).v+": "+Sk.misceval.objectRepr(d).v)}return new Sk.builtin.str("{"+a.join(", ")+"}")};Sk.builtin.dict.prototype.mp$length=function(){return this.size};Sk.builtin.dict.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.dict.prototype.tp$hash=Sk.builtin.object.prototype.HashNotImplemented;
Sk.builtin.dict.prototype.tp$richcompare=function(a,b){if(this===a&&Sk.misceval.opAllowsEquality(b))return!0;switch(b){case "Lt":return;case "LtE":return;case "Eq":break;case "NotEq":break;case "Gt":return;case "GtE":return;default:goog.asserts.fail()}if(!(a instanceof Sk.builtin.dict)||this.size!==a.size)return"Eq"===b?!1:!0;for(var c=this.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext()){var e=this.mp$subscript(d),d=a.mp$subscript(d);if(!Sk.misceval.richCompareBool(e,d,"Eq"))return"Eq"===
b?!1:!0}return"Eq"===b?!0:!1};Sk.builtin.dict.prototype.get=new Sk.builtin.func(function(a,b,c){void 0===c&&(c=null);a=a.mp$lookup(b);void 0===a&&(a=c);return a});Sk.builtin.dict.prototype.has_key=new Sk.builtin.func(function(a,b){return Sk.builtin.bool(a.sq$contains(b))});Sk.builtin.dict.prototype.items=new Sk.builtin.func(function(a){for(var b=[],c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext()){var e=a.mp$subscript(d);void 0===e&&(e=null);b.push(new Sk.builtin.tuple([d,e]))}return new Sk.builtin.list(b)});
Sk.builtin.dict.prototype.keys=new Sk.builtin.func(function(a){var b=[];a=a.tp$iter();for(var c=a.tp$iternext();void 0!==c;c=a.tp$iternext())b.push(c);return new Sk.builtin.list(b)});Sk.builtin.dict.prototype.values=new Sk.builtin.func(function(a){for(var b=[],c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())d=a.mp$subscript(d),void 0===d&&(d=null),b.push(d);return new Sk.builtin.list(b)});Sk.builtin.dict.prototype.tp$name="dict";goog.exportSymbol("Sk.builtin.dict",Sk.builtin.dict);Sk.builtin.biginteger=function(a,b,c){null!=a&&("number"==typeof a?this.fromNumber(a,b,c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))};Sk.builtin.biginteger.canary=0xdeadbeefcafe;Sk.builtin.biginteger.j_lm=15715070==(Sk.builtin.biginteger.canary&16777215);Sk.builtin.biginteger.nbi=function(){return new Sk.builtin.biginteger(null)};Sk.builtin.biginteger.prototype.am1=function(a,b,c,d,e,f){for(;0<=--f;){var g=b*this[a++]+c[d]+e;e=Math.floor(g/67108864);c[d++]=g&67108863}return e};
Sk.builtin.biginteger.prototype.am2=function(a,b,c,d,e,f){var g=b&32767;for(b>>=15;0<=--f;){var h=this[a]&32767,k=this[a++]>>15,l=b*h+k*g,h=g*h+((l&32767)<<15)+c[d]+(e&1073741823);e=(h>>>30)+(l>>>15)+b*k+(e>>>30);c[d++]=h&1073741823}return e};Sk.builtin.biginteger.prototype.am3=function(a,b,c,d,e,f){var g=b&16383;for(b>>=14;0<=--f;){var h=this[a]&16383,k=this[a++]>>14,l=b*h+k*g,h=g*h+((l&16383)<<14)+c[d]+e;e=(h>>28)+(l>>14)+b*k;c[d++]=h&268435455}return e};Sk.builtin.biginteger.prototype.am=Sk.builtin.biginteger.prototype.am3;
Sk.builtin.biginteger.dbits=28;Sk.builtin.biginteger.prototype.DB=Sk.builtin.biginteger.dbits;Sk.builtin.biginteger.prototype.DM=(1<<Sk.builtin.biginteger.dbits)-1;Sk.builtin.biginteger.prototype.DV=1<<Sk.builtin.biginteger.dbits;Sk.builtin.biginteger.BI_FP=52;Sk.builtin.biginteger.prototype.FV=Math.pow(2,Sk.builtin.biginteger.BI_FP);Sk.builtin.biginteger.prototype.F1=Sk.builtin.biginteger.BI_FP-Sk.builtin.biginteger.dbits;Sk.builtin.biginteger.prototype.F2=2*Sk.builtin.biginteger.dbits-Sk.builtin.biginteger.BI_FP;
Sk.builtin.biginteger.BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";Sk.builtin.biginteger.BI_RC=[];var rr,vv;rr=48;for(vv=0;9>=vv;++vv)Sk.builtin.biginteger.BI_RC[rr++]=vv;rr=97;for(vv=10;36>vv;++vv)Sk.builtin.biginteger.BI_RC[rr++]=vv;rr=65;for(vv=10;36>vv;++vv)Sk.builtin.biginteger.BI_RC[rr++]=vv;Sk.builtin.biginteger.int2char=function(a){return Sk.builtin.biginteger.BI_RM.charAt(a)};Sk.builtin.biginteger.intAt=function(a,b){var c=Sk.builtin.biginteger.BI_RC[a.charCodeAt(b)];return null==c?-1:c};
Sk.builtin.biginteger.prototype.bnpCopyTo=function(a){for(var b=this.t-1;0<=b;--b)a[b]=this[b];a.t=this.t;a.s=this.s};Sk.builtin.biginteger.prototype.bnpFromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this[0]=a:-1>a?this[0]=a+this.DV:this.t=0};Sk.builtin.biginteger.nbv=function(a){var b=new Sk.builtin.biginteger(null);b.bnpFromInt(a);return b};
Sk.builtin.biginteger.prototype.bnpFromString=function(a,b){var c;if(16==b)c=4;else if(8==b)c=3;else if(256==b)c=8;else if(2==b)c=1;else if(32==b)c=5;else if(4==b)c=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var d=a.length,e=!1,f=0;0<=--d;){var g=8==c?a[d]&255:Sk.builtin.biginteger.intAt(a,d);0>g?"-"==a.charAt(d)&&(e=!0):(e=!1,0==f?this[this.t++]=g:f+c>this.DB?(this[this.t-1]|=(g&(1<<this.DB-f)-1)<<f,this[this.t++]=g>>this.DB-f):this[this.t-1]|=g<<f,f+=c,f>=this.DB&&(f-=this.DB))}8==c&&
0!=(a[0]&128)&&(this.s=-1,0<f&&(this[this.t-1]|=(1<<this.DB-f)-1<<f));this.clamp();e&&Sk.builtin.biginteger.ZERO.subTo(this,this)};Sk.builtin.biginteger.prototype.bnpClamp=function(){for(var a=this.s&this.DM;0<this.t&&this[this.t-1]==a;)--this.t};
Sk.builtin.biginteger.prototype.bnToString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",f=this.t,g=this.DB-f*this.DB%a;if(0<f--)for(g<this.DB&&0<(c=this[f]>>g)&&(d=!0,e=Sk.builtin.biginteger.int2char(c));0<=f;)g<a?(c=(this[f]&(1<<g)-1)<<a-g,c|=this[--f]>>(g+=this.DB-a)):(c=this[f]>>(g-=a)&b,0>=g&&(g+=this.DB,--f)),0<c&&(d=!0),d&&(e+=Sk.builtin.biginteger.int2char(c));
return d?e:"0"};Sk.builtin.biginteger.prototype.bnNegate=function(){var a=Sk.builtin.biginteger.nbi();Sk.builtin.biginteger.ZERO.subTo(this,a);return a};Sk.builtin.biginteger.prototype.bnAbs=function(){return 0>this.s?this.negate():this};Sk.builtin.biginteger.prototype.bnCompareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this[c]-a[c]))return b;return 0};
Sk.builtin.biginteger.nbits=function(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b};Sk.builtin.biginteger.prototype.bnBitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+Sk.builtin.biginteger.nbits(this[this.t-1]^this.s&this.DM)};Sk.builtin.biginteger.prototype.bnpDLShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b[c+a]=this[c];for(c=a-1;0<=c;--c)b[c]=0;b.t=this.t+a;b.s=this.s};
Sk.builtin.biginteger.prototype.bnpDRShiftTo=function(a,b){for(var c=a;c<this.t;++c)b[c-a]=this[c];b.t=Math.max(this.t-a,0);b.s=this.s};Sk.builtin.biginteger.prototype.bnpLShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,f=Math.floor(a/this.DB),g=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b[h+f+1]=this[h]>>d|g,g=(this[h]&e)<<c;for(h=f-1;0<=h;--h)b[h]=0;b[f]=g;b.t=this.t+f+1;b.s=this.s;b.clamp()};
Sk.builtin.biginteger.prototype.bnpRShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,f=(1<<d)-1;b[0]=this[c]>>d;for(var g=c+1;g<this.t;++g)b[g-c-1]|=(this[g]&f)<<e,b[g-c]=this[g]>>d;0<d&&(b[this.t-c-1]|=(this.s&f)<<e);b.t=this.t-c;b.clamp()}};
Sk.builtin.biginteger.prototype.bnpSubTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this[c]-a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this[c],b[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a[c],b[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b[c++]=this.DV+d:0<d&&(b[c++]=d);b.t=c;b.clamp()};
Sk.builtin.biginteger.prototype.bnpMultiplyTo=function(a,b){var c=this.abs(),d=a.abs(),e=c.t;for(b.t=e+d.t;0<=--e;)b[e]=0;for(e=0;e<d.t;++e)b[e+c.t]=c.am(0,d[e],b,e,0,c.t);b.s=0;b.clamp();this.s!=a.s&&Sk.builtin.biginteger.ZERO.subTo(b,b)};
Sk.builtin.biginteger.prototype.bnpSquareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b[c],a,2*c,0,1);(a[c+b.t]+=b.am(c+1,2*b[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a[c+b.t]-=b.DV,a[c+b.t+1]=1)}0<a.t&&(a[a.t-1]+=b.am(c,b[c],a,2*c,0,1));a.s=0;a.clamp()};
Sk.builtin.biginteger.prototype.bnpDivRemTo=function(a,b,c){var d=a.abs();if(!(0>=d.t)){var e=this.abs();if(e.t<d.t)null!=b&&b.fromInt(0),null!=c&&this.copyTo(c);else{null==c&&(c=Sk.builtin.biginteger.nbi());var f=Sk.builtin.biginteger.nbi(),g=this.s;a=a.s;var h=this.DB-Sk.builtin.biginteger.nbits(d[d.t-1]);0<h?(d.lShiftTo(h,f),e.lShiftTo(h,c)):(d.copyTo(f),e.copyTo(c));d=f.t;e=f[d-1];if(0!=e){var k=e*(1<<this.F1)+(1<d?f[d-2]>>this.F2:0),l=this.FV/k,k=(1<<this.F1)/k,m=1<<this.F2,n=c.t,p=n-d,q=null==
b?Sk.builtin.biginteger.nbi():b;f.dlShiftTo(p,q);0<=c.compareTo(q)&&(c[c.t++]=1,c.subTo(q,c));Sk.builtin.biginteger.ONE.dlShiftTo(d,q);for(q.subTo(f,f);f.t<d;)f[f.t++]=0;for(;0<=--p;){var r=c[--n]==e?this.DM:Math.floor(c[n]*l+(c[n-1]+m)*k);if((c[n]+=f.am(0,r,c,p,0,d))<r)for(f.dlShiftTo(p,q),c.subTo(q,c);c[n]<--r;)c.subTo(q,c)}null!=b&&(c.drShiftTo(d,b),g!=a&&Sk.builtin.biginteger.ZERO.subTo(b,b));c.t=d;c.clamp();0<h&&c.rShiftTo(h,c);0>g&&Sk.builtin.biginteger.ZERO.subTo(c,c)}}}};
Sk.builtin.biginteger.prototype.bnMod=function(a){var b=Sk.builtin.biginteger.nbi();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(Sk.builtin.biginteger.ZERO)&&a.subTo(b,b);return b};Sk.builtin.biginteger.Classic=function(a){this.m=a};Sk.builtin.biginteger.prototype.cConvert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};Sk.builtin.biginteger.prototype.cRevert=function(a){return a};Sk.builtin.biginteger.prototype.cReduce=function(a){a.divRemTo(this.m,null,a)};
Sk.builtin.biginteger.prototype.cMulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Sk.builtin.biginteger.prototype.cSqrTo=function(a,b){a.squareTo(b);this.reduce(b)};Sk.builtin.biginteger.Classic.prototype.convert=Sk.builtin.biginteger.prototype.cConvert;Sk.builtin.biginteger.Classic.prototype.revert=Sk.builtin.biginteger.prototype.cRevert;Sk.builtin.biginteger.Classic.prototype.reduce=Sk.builtin.biginteger.prototype.cReduce;Sk.builtin.biginteger.Classic.prototype.mulTo=Sk.builtin.biginteger.prototype.cMulTo;
Sk.builtin.biginteger.Classic.prototype.sqrTo=Sk.builtin.biginteger.prototype.cSqrTo;Sk.builtin.biginteger.prototype.bnpInvDigit=function(){if(1>this.t)return 0;var a=this[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};Sk.builtin.biginteger.Montgomery=function(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t};
Sk.builtin.biginteger.prototype.montConvert=function(a){var b=Sk.builtin.biginteger.nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(Sk.builtin.biginteger.ZERO)&&this.m.subTo(b,b);return b};Sk.builtin.biginteger.prototype.montRevert=function(a){var b=Sk.builtin.biginteger.nbi();a.copyTo(b);this.reduce(b);return b};
Sk.builtin.biginteger.prototype.montReduce=function(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=a[b]&32767,d=c*this.mpl+((c*this.mph+(a[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a[c]+=this.m.am(0,d,a,b,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};Sk.builtin.biginteger.prototype.montSqrTo=function(a,b){a.squareTo(b);this.reduce(b)};
Sk.builtin.biginteger.prototype.montMulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Sk.builtin.biginteger.Montgomery.prototype.convert=Sk.builtin.biginteger.prototype.montConvert;Sk.builtin.biginteger.Montgomery.prototype.revert=Sk.builtin.biginteger.prototype.montRevert;Sk.builtin.biginteger.Montgomery.prototype.reduce=Sk.builtin.biginteger.prototype.montReduce;Sk.builtin.biginteger.Montgomery.prototype.mulTo=Sk.builtin.biginteger.prototype.montMulTo;
Sk.builtin.biginteger.Montgomery.prototype.sqrTo=Sk.builtin.biginteger.prototype.montSqrTo;Sk.builtin.biginteger.prototype.bnpIsEven=function(){return 0==(0<this.t?this[0]&1:this.s)};Sk.builtin.biginteger.prototype.bnpExp=function(a,b){if(4294967295<a||1>a)return Sk.builtin.biginteger.ONE;var c=Sk.builtin.biginteger.nbi(),d=Sk.builtin.biginteger.nbi(),e=b.convert(this),f=Sk.builtin.biginteger.nbits(a)-1;for(e.copyTo(c);0<=--f;)if(b.sqrTo(c,d),0<(a&1<<f))b.mulTo(d,e,c);else var g=c,c=d,d=g;return b.revert(c)};
Sk.builtin.biginteger.prototype.bnModPowInt=function(a,b){var c;c=256>a||b.isEven()?new Sk.builtin.biginteger.Classic(b):new Sk.builtin.biginteger.Montgomery(b);return this.exp(a,c)};Sk.builtin.biginteger.prototype.copyTo=Sk.builtin.biginteger.prototype.bnpCopyTo;Sk.builtin.biginteger.prototype.fromInt=Sk.builtin.biginteger.prototype.bnpFromInt;Sk.builtin.biginteger.prototype.fromString=Sk.builtin.biginteger.prototype.bnpFromString;Sk.builtin.biginteger.prototype.clamp=Sk.builtin.biginteger.prototype.bnpClamp;
Sk.builtin.biginteger.prototype.dlShiftTo=Sk.builtin.biginteger.prototype.bnpDLShiftTo;Sk.builtin.biginteger.prototype.drShiftTo=Sk.builtin.biginteger.prototype.bnpDRShiftTo;Sk.builtin.biginteger.prototype.lShiftTo=Sk.builtin.biginteger.prototype.bnpLShiftTo;Sk.builtin.biginteger.prototype.rShiftTo=Sk.builtin.biginteger.prototype.bnpRShiftTo;Sk.builtin.biginteger.prototype.subTo=Sk.builtin.biginteger.prototype.bnpSubTo;Sk.builtin.biginteger.prototype.multiplyTo=Sk.builtin.biginteger.prototype.bnpMultiplyTo;
Sk.builtin.biginteger.prototype.squareTo=Sk.builtin.biginteger.prototype.bnpSquareTo;Sk.builtin.biginteger.prototype.divRemTo=Sk.builtin.biginteger.prototype.bnpDivRemTo;Sk.builtin.biginteger.prototype.invDigit=Sk.builtin.biginteger.prototype.bnpInvDigit;Sk.builtin.biginteger.prototype.isEven=Sk.builtin.biginteger.prototype.bnpIsEven;Sk.builtin.biginteger.prototype.exp=Sk.builtin.biginteger.prototype.bnpExp;Sk.builtin.biginteger.prototype.toString=Sk.builtin.biginteger.prototype.bnToString;
Sk.builtin.biginteger.prototype.negate=Sk.builtin.biginteger.prototype.bnNegate;Sk.builtin.biginteger.prototype.abs=Sk.builtin.biginteger.prototype.bnAbs;Sk.builtin.biginteger.prototype.compareTo=Sk.builtin.biginteger.prototype.bnCompareTo;Sk.builtin.biginteger.prototype.bitLength=Sk.builtin.biginteger.prototype.bnBitLength;Sk.builtin.biginteger.prototype.mod=Sk.builtin.biginteger.prototype.bnMod;Sk.builtin.biginteger.prototype.modPowInt=Sk.builtin.biginteger.prototype.bnModPowInt;
Sk.builtin.biginteger.ZERO=Sk.builtin.biginteger.nbv(0);Sk.builtin.biginteger.ONE=Sk.builtin.biginteger.nbv(1);Sk.builtin.biginteger.prototype.bnClone=function(){var a=Sk.builtin.biginteger.nbi();this.copyTo(a);return a};Sk.builtin.biginteger.prototype.bnIntValue=function(){if(0>this.s){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]};
Sk.builtin.biginteger.prototype.bnByteValue=function(){return 0==this.t?this.s:this[0]<<24>>24};Sk.builtin.biginteger.prototype.bnShortValue=function(){return 0==this.t?this.s:this[0]<<16>>16};Sk.builtin.biginteger.prototype.bnpChunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};Sk.builtin.biginteger.prototype.bnSigNum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1};
Sk.builtin.biginteger.prototype.bnpToRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,b),c=Sk.builtin.biginteger.nbv(b),d=Sk.builtin.biginteger.nbi(),e=Sk.builtin.biginteger.nbi(),f="";for(this.divRemTo(c,d,e);0<d.signum();)f=(b+e.intValue()).toString(a).substr(1)+f,d.divRemTo(c,d,e);return e.intValue().toString(a)+f};
Sk.builtin.biginteger.prototype.bnpFromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var c=this.chunkSize(b),d=Math.pow(b,c),e=!1,f=0,g=0,h=0;h<a.length;++h){var k=Sk.builtin.biginteger.intAt(a,h);if(0>k){if("-"==a.charAt(h)&&0==this.signum()&&(e=!0),"."==a.charAt(h))break}else g=b*g+k,++f>=c&&(this.dMultiply(d),this.dAddOffset(g,0),g=f=0)}0<f&&(this.dMultiply(Math.pow(b,f)),this.dAddOffset(g,0));e&&Sk.builtin.biginteger.ZERO.subTo(this,this)};
Sk.builtin.biginteger.prototype.bnpFromNumber=function(a,b,c){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(Sk.builtin.biginteger.ONE.shiftLeft(a-1),Sk.builtin.biginteger.op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(Sk.builtin.biginteger.ONE.shiftLeft(a-1),this);this.fromString(a+"")};
Sk.builtin.biginteger.prototype.bnToByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this[a]&(1<<c)-1)<<8-c,d|=this[--a]>>(c+=this.DB-8)):(d=this[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};Sk.builtin.biginteger.prototype.bnEquals=function(a){return 0==this.compareTo(a)};
Sk.builtin.biginteger.prototype.bnMin=function(a){return 0>this.compareTo(a)?this:a};Sk.builtin.biginteger.prototype.bnMax=function(a){return 0<this.compareTo(a)?this:a};Sk.builtin.biginteger.prototype.bnpBitwiseTo=function(a,b,c){var d,e,f=Math.min(a.t,this.t);for(d=0;d<f;++d)c[d]=b(this[d],a[d]);if(a.t<this.t){e=a.s&this.DM;for(d=f;d<this.t;++d)c[d]=b(this[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=f;d<a.t;++d)c[d]=b(e,a[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};
Sk.builtin.biginteger.op_and=function(a,b){return a&b};Sk.builtin.biginteger.prototype.bnAnd=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_and,b);return b};Sk.builtin.biginteger.op_or=function(a,b){return a|b};Sk.builtin.biginteger.prototype.bnOr=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_or,b);return b};Sk.builtin.biginteger.op_xor=function(a,b){return a^b};
Sk.builtin.biginteger.prototype.bnXor=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_xor,b);return b};Sk.builtin.biginteger.op_andnot=function(a,b){return a&~b};Sk.builtin.biginteger.prototype.bnAndNot=function(a){var b=Sk.builtin.biginteger.nbi();this.bitwiseTo(a,Sk.builtin.biginteger.op_andnot,b);return b};Sk.builtin.biginteger.prototype.bnNot=function(){for(var a=Sk.builtin.biginteger.nbi(),b=0;b<this.t;++b)a[b]=this.DM&~this[b];a.t=this.t;a.s=~this.s;return a};
Sk.builtin.biginteger.prototype.bnShiftLeft=function(a){var b=Sk.builtin.biginteger.nbi();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};Sk.builtin.biginteger.prototype.bnShiftRight=function(a){var b=Sk.builtin.biginteger.nbi();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};Sk.builtin.biginteger.lbit=function(a){if(0==a)return-1;var b=0;0==(a&65535)&&(a>>=16,b+=16);0==(a&255)&&(a>>=8,b+=8);0==(a&15)&&(a>>=4,b+=4);0==(a&3)&&(a>>=2,b+=2);0==(a&1)&&++b;return b};
Sk.builtin.biginteger.prototype.bnGetLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this[a])return a*this.DB+Sk.builtin.biginteger.lbit(this[a]);return 0>this.s?this.t*this.DB:-1};Sk.builtin.biginteger.cbit=function(a){for(var b=0;0!=a;)a&=a-1,++b;return b};Sk.builtin.biginteger.prototype.bnBitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c)a+=Sk.builtin.biginteger.cbit(this[c]^b);return a};
Sk.builtin.biginteger.prototype.bnTestBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this[b]&1<<a%this.DB)};Sk.builtin.biginteger.prototype.bnpChangeBit=function(a,b){var c=Sk.builtin.biginteger.ONE.shiftLeft(a);this.bitwiseTo(c,b,c);return c};Sk.builtin.biginteger.prototype.bnSetBit=function(a){return this.changeBit(a,Sk.builtin.biginteger.op_or)};Sk.builtin.biginteger.prototype.bnClearBit=function(a){return this.changeBit(a,Sk.builtin.biginteger.op_andnot)};
Sk.builtin.biginteger.prototype.bnFlipBit=function(a){return this.changeBit(a,Sk.builtin.biginteger.op_xor)};Sk.builtin.biginteger.prototype.bnpAddTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this[c]+a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=this[c],b[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a[c],b[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b[c++]=d:-1>d&&(b[c++]=this.DV+d);b.t=c;b.clamp()};
Sk.builtin.biginteger.prototype.bnAdd=function(a){var b=Sk.builtin.biginteger.nbi();this.addTo(a,b);return b};Sk.builtin.biginteger.prototype.bnSubtract=function(a){var b=Sk.builtin.biginteger.nbi();this.subTo(a,b);return b};Sk.builtin.biginteger.prototype.bnMultiply=function(a){var b=Sk.builtin.biginteger.nbi();this.multiplyTo(a,b);return b};Sk.builtin.biginteger.prototype.bnDivide=function(a){var b=Sk.builtin.biginteger.nbi();this.divRemTo(a,b,null);return b};
Sk.builtin.biginteger.prototype.bnRemainder=function(a){var b=Sk.builtin.biginteger.nbi();this.divRemTo(a,null,b);return b};Sk.builtin.biginteger.prototype.bnDivideAndRemainder=function(a){var b=Sk.builtin.biginteger.nbi(),c=Sk.builtin.biginteger.nbi();this.divRemTo(a,b,c);return[b,c]};Sk.builtin.biginteger.prototype.bnpDMultiply=function(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};
Sk.builtin.biginteger.prototype.bnpDAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this[this.t++]=0;for(this[b]+=a;this[b]>=this.DV;)this[b]-=this.DV,++b>=this.t&&(this[this.t++]=0),++this[b]}};Sk.builtin.biginteger.NullExp=function(){};Sk.builtin.biginteger.prototype.nNop=function(a){return a};Sk.builtin.biginteger.prototype.nMulTo=function(a,b,c){a.multiplyTo(b,c)};Sk.builtin.biginteger.prototype.nSqrTo=function(a,b){a.squareTo(b)};Sk.builtin.biginteger.NullExp.prototype.convert=Sk.builtin.biginteger.prototype.nNop;
Sk.builtin.biginteger.NullExp.prototype.revert=Sk.builtin.biginteger.prototype.nNop;Sk.builtin.biginteger.NullExp.prototype.mulTo=Sk.builtin.biginteger.prototype.nMulTo;Sk.builtin.biginteger.NullExp.prototype.sqrTo=Sk.builtin.biginteger.prototype.nSqrTo;Sk.builtin.biginteger.prototype.bnPow=function(a){return this.exp(a,new Sk.builtin.biginteger.NullExp)};
Sk.builtin.biginteger.prototype.bnpMultiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c[d+this.t]=this.am(0,a[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a[d],c,d,0,b-d);c.clamp()};Sk.builtin.biginteger.prototype.bnpMultiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c[this.t+d-b]=this.am(b-d,a[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,c)};
Sk.builtin.biginteger.Barrett=function(a){this.r2=Sk.builtin.biginteger.nbi();this.q3=Sk.builtin.biginteger.nbi();Sk.builtin.biginteger.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a};Sk.builtin.biginteger.prototype.barrettConvert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=Sk.builtin.biginteger.nbi();a.copyTo(b);this.reduce(b);return b};Sk.builtin.biginteger.prototype.barrettRevert=function(a){return a};
Sk.builtin.biginteger.prototype.barrettReduce=function(a){a.drShiftTo(this.m.t-1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};Sk.builtin.biginteger.prototype.barrettSqrTo=function(a,b){a.squareTo(b);this.reduce(b)};
Sk.builtin.biginteger.prototype.barrettMulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Sk.builtin.biginteger.Barrett.prototype.convert=Sk.builtin.biginteger.prototype.barrettConvert;Sk.builtin.biginteger.Barrett.prototype.revert=Sk.builtin.biginteger.prototype.barrettRevert;Sk.builtin.biginteger.Barrett.prototype.reduce=Sk.builtin.biginteger.prototype.barrettReduce;Sk.builtin.biginteger.Barrett.prototype.mulTo=Sk.builtin.biginteger.prototype.barrettMulTo;
Sk.builtin.biginteger.Barrett.prototype.sqrTo=Sk.builtin.biginteger.prototype.barrettSqrTo;
Sk.builtin.biginteger.prototype.bnModPow=function(a,b){var c=a.bitLength(),d,e=Sk.builtin.biginteger.nbv(1),f;if(0>=c)return e;d=18>c?1:48>c?3:144>c?4:768>c?5:6;f=8>c?new Sk.builtin.biginteger.Classic(b):b.isEven()?new Sk.builtin.biginteger.Barrett(b):new Sk.builtin.biginteger.Montgomery(b);var g=[],h=3,k=d-1,l=(1<<d)-1;g[1]=f.convert(this);if(1<d)for(c=Sk.builtin.biginteger.nbi(),f.sqrTo(g[1],c);h<=l;)g[h]=Sk.builtin.biginteger.nbi(),f.mulTo(c,g[h-2],g[h]),h+=2;for(var m=a.t-1,n,p=!0,q=Sk.builtin.biginteger.nbi(),
c=Sk.builtin.biginteger.nbits(a[m])-1;0<=m;){c>=k?n=a[m]>>c-k&l:(n=(a[m]&(1<<c+1)-1)<<k-c,0<m&&(n|=a[m-1]>>this.DB+c-k));for(h=d;0==(n&1);)n>>=1,--h;0>(c-=h)&&(c+=this.DB,--m);if(p)g[n].copyTo(e),p=!1;else{for(;1<h;)f.sqrTo(e,q),f.sqrTo(q,e),h-=2;0<h?f.sqrTo(e,q):(h=e,e=q,q=h);f.mulTo(q,g[n],e)}for(;0<=m&&0==(a[m]&1<<c);)f.sqrTo(e,q),h=e,e=q,q=h,0>--c&&(c=this.DB-1,--m)}return f.revert(e)};
Sk.builtin.biginteger.prototype.bnGCD=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};
Sk.builtin.biginteger.prototype.bnpModInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this[d])%a;return c};
Sk.builtin.biginteger.prototype.bnModInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return Sk.builtin.biginteger.ZERO;for(var c=a.clone(),d=this.clone(),e=Sk.builtin.biginteger.nbv(1),f=Sk.builtin.biginteger.nbv(0),g=Sk.builtin.biginteger.nbv(0),h=Sk.builtin.biginteger.nbv(1);0!=c.signum();){for(;c.isEven();)c.rShiftTo(1,c),b?(e.isEven()&&f.isEven()||(e.addTo(this,e),f.subTo(a,f)),e.rShiftTo(1,e)):f.isEven()||f.subTo(a,f),f.rShiftTo(1,f);for(;d.isEven();)d.rShiftTo(1,d),b?
(g.isEven()&&h.isEven()||(g.addTo(this,g),h.subTo(a,h)),g.rShiftTo(1,g)):h.isEven()||h.subTo(a,h),h.rShiftTo(1,h);0<=c.compareTo(d)?(c.subTo(d,c),b&&e.subTo(g,e),f.subTo(h,f)):(d.subTo(c,d),b&&g.subTo(e,g),h.subTo(f,h))}if(0!=d.compareTo(Sk.builtin.biginteger.ONE))return Sk.builtin.biginteger.ZERO;if(0<=h.compareTo(a))return h.subtract(a);if(0>h.signum())h.addTo(a,h);else return h;return 0>h.signum()?h.add(a):h};
Sk.builtin.biginteger.lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509];
Sk.builtin.biginteger.lplim=67108864/Sk.builtin.biginteger.lowprimes[Sk.builtin.biginteger.lowprimes.length-1];
Sk.builtin.biginteger.prototype.bnIsProbablePrime=function(a){var b,c=this.abs();if(1==c.t&&c[0]<=Sk.builtin.biginteger.lowprimes[Sk.builtin.biginteger.lowprimes.length-1]){for(b=0;b<Sk.builtin.biginteger.lowprimes.length;++b)if(c[0]==Sk.builtin.biginteger.lowprimes[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<Sk.builtin.biginteger.lowprimes.length;){for(var d=Sk.builtin.biginteger.lowprimes[b],e=b+1;e<Sk.builtin.biginteger.lowprimes.length&&d<Sk.builtin.biginteger.lplim;)d*=Sk.builtin.biginteger.lowprimes[e++];
for(d=c.modInt(d);b<e;)if(0==d%Sk.builtin.biginteger.lowprimes[b++])return!1}return c.millerRabin(a)};
Sk.builtin.biginteger.prototype.bnpMillerRabin=function(a){var b=this.subtract(Sk.builtin.biginteger.ONE),c=b.getLowestSetBit();if(0>=c)return!1;var d=b.shiftRight(c);a=a+1>>1;a>Sk.builtin.biginteger.lowprimes.length&&(a=Sk.builtin.biginteger.lowprimes.length);for(var e=Sk.builtin.biginteger.nbi(),f=0;f<a;++f){e.fromInt(Sk.builtin.biginteger.lowprimes[f]);var g=e.modPow(d,this);if(0!=g.compareTo(Sk.builtin.biginteger.ONE)&&0!=g.compareTo(b)){for(var h=1;h++<c&&0!=g.compareTo(b);)if(g=g.modPowInt(2,
this),0==g.compareTo(Sk.builtin.biginteger.ONE))return!1;if(0!=g.compareTo(b))return!1}}return!0};Sk.builtin.biginteger.prototype.isnegative=function(){return 0>this.s};Sk.builtin.biginteger.prototype.ispositive=function(){return 0<=this.s};Sk.builtin.biginteger.prototype.trueCompare=function(a){return 0<=this.s&&0>a.s?1:0>this.s&&0<=a.s?-1:this.compare(a)};Sk.builtin.biginteger.prototype.chunkSize=Sk.builtin.biginteger.prototype.bnpChunkSize;Sk.builtin.biginteger.prototype.toRadix=Sk.builtin.biginteger.prototype.bnpToRadix;
Sk.builtin.biginteger.prototype.fromRadix=Sk.builtin.biginteger.prototype.bnpFromRadix;Sk.builtin.biginteger.prototype.fromNumber=Sk.builtin.biginteger.prototype.bnpFromNumber;Sk.builtin.biginteger.prototype.bitwiseTo=Sk.builtin.biginteger.prototype.bnpBitwiseTo;Sk.builtin.biginteger.prototype.changeBit=Sk.builtin.biginteger.prototype.bnpChangeBit;Sk.builtin.biginteger.prototype.addTo=Sk.builtin.biginteger.prototype.bnpAddTo;Sk.builtin.biginteger.prototype.dMultiply=Sk.builtin.biginteger.prototype.bnpDMultiply;
Sk.builtin.biginteger.prototype.dAddOffset=Sk.builtin.biginteger.prototype.bnpDAddOffset;Sk.builtin.biginteger.prototype.multiplyLowerTo=Sk.builtin.biginteger.prototype.bnpMultiplyLowerTo;Sk.builtin.biginteger.prototype.multiplyUpperTo=Sk.builtin.biginteger.prototype.bnpMultiplyUpperTo;Sk.builtin.biginteger.prototype.modInt=Sk.builtin.biginteger.prototype.bnpModInt;Sk.builtin.biginteger.prototype.millerRabin=Sk.builtin.biginteger.prototype.bnpMillerRabin;Sk.builtin.biginteger.prototype.clone=Sk.builtin.biginteger.prototype.bnClone;
Sk.builtin.biginteger.prototype.intValue=Sk.builtin.biginteger.prototype.bnIntValue;Sk.builtin.biginteger.prototype.byteValue=Sk.builtin.biginteger.prototype.bnByteValue;Sk.builtin.biginteger.prototype.shortValue=Sk.builtin.biginteger.prototype.bnShortValue;Sk.builtin.biginteger.prototype.signum=Sk.builtin.biginteger.prototype.bnSigNum;Sk.builtin.biginteger.prototype.toByteArray=Sk.builtin.biginteger.prototype.bnToByteArray;Sk.builtin.biginteger.prototype.equals=Sk.builtin.biginteger.prototype.bnEquals;
Sk.builtin.biginteger.prototype.compare=Sk.builtin.biginteger.prototype.compareTo;Sk.builtin.biginteger.prototype.min=Sk.builtin.biginteger.prototype.bnMin;Sk.builtin.biginteger.prototype.max=Sk.builtin.biginteger.prototype.bnMax;Sk.builtin.biginteger.prototype.and=Sk.builtin.biginteger.prototype.bnAnd;Sk.builtin.biginteger.prototype.or=Sk.builtin.biginteger.prototype.bnOr;Sk.builtin.biginteger.prototype.xor=Sk.builtin.biginteger.prototype.bnXor;Sk.builtin.biginteger.prototype.andNot=Sk.builtin.biginteger.prototype.bnAndNot;
Sk.builtin.biginteger.prototype.not=Sk.builtin.biginteger.prototype.bnNot;Sk.builtin.biginteger.prototype.shiftLeft=Sk.builtin.biginteger.prototype.bnShiftLeft;Sk.builtin.biginteger.prototype.shiftRight=Sk.builtin.biginteger.prototype.bnShiftRight;Sk.builtin.biginteger.prototype.getLowestSetBit=Sk.builtin.biginteger.prototype.bnGetLowestSetBit;Sk.builtin.biginteger.prototype.bitCount=Sk.builtin.biginteger.prototype.bnBitCount;Sk.builtin.biginteger.prototype.testBit=Sk.builtin.biginteger.prototype.bnTestBit;
Sk.builtin.biginteger.prototype.setBit=Sk.builtin.biginteger.prototype.bnSetBit;Sk.builtin.biginteger.prototype.clearBit=Sk.builtin.biginteger.prototype.bnClearBit;Sk.builtin.biginteger.prototype.flipBit=Sk.builtin.biginteger.prototype.bnFlipBit;Sk.builtin.biginteger.prototype.add=Sk.builtin.biginteger.prototype.bnAdd;Sk.builtin.biginteger.prototype.subtract=Sk.builtin.biginteger.prototype.bnSubtract;Sk.builtin.biginteger.prototype.multiply=Sk.builtin.biginteger.prototype.bnMultiply;
Sk.builtin.biginteger.prototype.divide=Sk.builtin.biginteger.prototype.bnDivide;Sk.builtin.biginteger.prototype.remainder=Sk.builtin.biginteger.prototype.bnRemainder;Sk.builtin.biginteger.prototype.divideAndRemainder=Sk.builtin.biginteger.prototype.bnDivideAndRemainder;Sk.builtin.biginteger.prototype.modPow=Sk.builtin.biginteger.prototype.bnModPow;Sk.builtin.biginteger.prototype.modInverse=Sk.builtin.biginteger.prototype.bnModInverse;Sk.builtin.biginteger.prototype.pow=Sk.builtin.biginteger.prototype.bnPow;
Sk.builtin.biginteger.prototype.gcd=Sk.builtin.biginteger.prototype.bnGCD;Sk.builtin.biginteger.prototype.isProbablePrime=Sk.builtin.biginteger.prototype.bnIsProbablePrime;Sk.builtin.nmber=function(a,b){if(!(this instanceof Sk.builtin.nmber))return new Sk.builtin.nmber(a,b);a instanceof Sk.builtin.str&&(a=a.v);if(a instanceof Sk.builtin.nmber)this.v=a.v,this.skType=a.skType;else if("number"===typeof a)if(this.v=a,void 0===b)this.skType=a>Sk.builtin.nmber.threshold$||a<-Sk.builtin.nmber.threshold$||0!=a%1?Sk.builtin.nmber.float$:Sk.builtin.nmber.int$;else{if(this.skType=b,b===Sk.builtin.nmber.int$&&(a>Sk.builtin.nmber.threshold$||a<-Sk.builtin.nmber.threshold$))return new Sk.builtin.lng(a)}else{if("string"===
typeof a){var c=Sk.numberFromStr(a);void 0!==b&&(c.skType=b);return b===Sk.builtin.nmber.int$&&(c.v>Sk.builtin.nmber.threshold$||c.v<-Sk.builtin.nmber.threshold$)?new Sk.builtin.lng(a):c}if(a instanceof Sk.builtin.lng)return Sk.numberFromStr(a.str$(10,!0));if(a instanceof Sk.builtin.biginteger){if(c=Sk.numberFromStr(a.toString()),void 0!==b&&(c.skType=b),b===Sk.builtin.nmber.int$&&(c.v>Sk.builtin.nmber.threshold$||c.v<-Sk.builtin.nmber.threshold$))return new Sk.builtin.lng(a)}else this.v=0,this.skType=
void 0===b?Sk.builtin.nmber.int$:b}return this};Sk.builtin.nmber.prototype.tp$index=function(){return this.v};Sk.builtin.nmber.prototype.tp$hash=function(){return this.v};Sk.builtin.nmber.prototype.tp$name="number";Sk.builtin.nmber.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("number",Sk.builtin.nmber);Sk.builtin.nmber.threshold$=Math.pow(2,53);Sk.builtin.nmber.float$="float";Sk.builtin.nmber.int$="int";Sk.builtin.nmber.fromInt$=function(a){return new Sk.builtin.nmber(a,void 0)};
Sk.numberFromStr=function(a){if("inf"==a)return new Sk.builtin.nmber(Infinity,void 0);if("-inf"==a)return new Sk.builtin.nmber(-Infinity,void 0);var b=new Sk.builtin.nmber(0,void 0);if(-1!==a.indexOf(".")||-1!==a.indexOf("e")||-1!==a.indexOf("E"))return b.v=parseFloat(a),b.skType=Sk.builtin.nmber.float$,b;var c=a;"-"===a.charAt(0)&&(c=a.substr(1));a="0"!==c.charAt(0)||"x"!==c.charAt(1)&&"X"!==c.charAt(1)?"0"!==c.charAt(0)||"b"!==c.charAt(1)&&"B"!==c.charAt(1)?"0"===c.charAt(0)?parseInt(a,8):parseInt(a,
10):parseInt(a,2):parseInt(a,16);b.v=a;b.skType=Sk.builtin.nmber.int$;return b};goog.exportSymbol("Sk.numberFromStr",Sk.numberFromStr);Sk.builtin.nmber.prototype.clone=function(){return new Sk.builtin.nmber(this,void 0)};Sk.builtin.nmber.prototype.toFixed=function(a){a=Sk.builtin.asnum$(a);return this.v.toFixed(a)};
Sk.builtin.nmber.prototype.nb$add=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.nmber(a,void 0));if(a instanceof Sk.builtin.nmber){b=new Sk.builtin.nmber(this.v+a.v,void 0);if(this.skType===Sk.builtin.nmber.float$||a.skType===Sk.builtin.nmber.float$)b.skType=Sk.builtin.nmber.float$;else if(b.skType=Sk.builtin.nmber.int$,b.v>Sk.builtin.nmber.threshold$||b.v<-Sk.builtin.nmber.threshold$)b=(new Sk.builtin.lng(this.v)).nb$add(a.v);return b}if(a instanceof Sk.builtin.lng)return b=this.skType===
Sk.builtin.nmber.float$?new Sk.builtin.nmber(this.v+parseFloat(a.str$(10,!0)),Sk.builtin.nmber.float$):(new Sk.builtin.lng(this.v)).nb$add(a)};
Sk.builtin.nmber.prototype.nb$subtract=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.nmber(a,void 0));if(a instanceof Sk.builtin.nmber){b=new Sk.builtin.nmber(this.v-a.v,void 0);if(this.skType===Sk.builtin.nmber.float$||a.skType===Sk.builtin.nmber.float$)b.skType=Sk.builtin.nmber.float$;else if(b.skType=Sk.builtin.nmber.int$,b.v>Sk.builtin.nmber.threshold$||b.v<-Sk.builtin.nmber.threshold$)b=(new Sk.builtin.lng(this.v)).nb$subtract(a.v);return b}if(a instanceof Sk.builtin.lng)return b=
this.skType===Sk.builtin.nmber.float$?new Sk.builtin.nmber(this.v-parseFloat(a.str$(10,!0)),Sk.builtin.nmber.float$):(new Sk.builtin.lng(this.v)).nb$subtract(a)};
Sk.builtin.nmber.prototype.nb$multiply=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.nmber(a,void 0));if(a instanceof Sk.builtin.nmber){b=new Sk.builtin.nmber(this.v*a.v,void 0);if(this.skType===Sk.builtin.nmber.float$||a.skType===Sk.builtin.nmber.float$)b.skType=Sk.builtin.nmber.float$;else if(b.skType=Sk.builtin.nmber.int$,b.v>Sk.builtin.nmber.threshold$||b.v<-Sk.builtin.nmber.threshold$)b=(new Sk.builtin.lng(this.v)).nb$multiply(a.v);return b}if(a instanceof Sk.builtin.lng)return b=
this.skType===Sk.builtin.nmber.float$?new Sk.builtin.nmber(this.v*parseFloat(a.str$(10,!0)),Sk.builtin.nmber.float$):(new Sk.builtin.lng(this.v)).nb$multiply(a)};
Sk.builtin.nmber.prototype.nb$divide=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.nmber(a,void 0));if(a instanceof Sk.builtin.nmber){if(0==a.v)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(Infinity===this.v)return Infinity===a.v||-Infinity===a.v?new Sk.builtin.nmber(NaN,Sk.builtin.nmber.float$):a.nb$isnegative()?new Sk.builtin.nmber(-Infinity,Sk.builtin.nmber.float$):new Sk.builtin.nmber(Infinity,Sk.builtin.nmber.float$);if(-Infinity===this.v)return Infinity===
a.v||-Infinity===a.v?new Sk.builtin.nmber(NaN,Sk.builtin.nmber.float$):a.nb$isnegative()?new Sk.builtin.nmber(Infinity,Sk.builtin.nmber.float$):new Sk.builtin.nmber(-Infinity,Sk.builtin.nmber.float$);b=new Sk.builtin.nmber(this.v/a.v,void 0);if(this.skType===Sk.builtin.nmber.float$||a.skType===Sk.builtin.nmber.float$||Sk.python3)b.skType=Sk.builtin.nmber.float$;else if(b.v=Math.floor(b.v),b.skType=Sk.builtin.nmber.int$,b.v>Sk.builtin.nmber.threshold$||b.v<-Sk.builtin.nmber.threshold$)b=(new Sk.builtin.lng(this.v)).nb$divide(a.v);
return b}if(a instanceof Sk.builtin.lng){if(0==a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");return Infinity===this.v?a.nb$isnegative()?new Sk.builtin.nmber(-Infinity,Sk.builtin.nmber.float$):new Sk.builtin.nmber(Infinity,Sk.builtin.nmber.float$):-Infinity===this.v?a.nb$isnegative()?new Sk.builtin.nmber(Infinity,Sk.builtin.nmber.float$):new Sk.builtin.nmber(-Infinity,Sk.builtin.nmber.float$):b=this.skType===Sk.builtin.nmber.float$?
new Sk.builtin.nmber(this.v/parseFloat(a.str$(10,!0)),Sk.builtin.nmber.float$):(new Sk.builtin.lng(this.v)).nb$divide(a)}};
Sk.builtin.nmber.prototype.nb$floor_divide=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.nmber(a,void 0));if(Infinity===this.v||-Infinity===this.v)return new Sk.builtin.nmber(NaN,Sk.builtin.nmber.float$);if(a instanceof Sk.builtin.nmber){if(0==a.v)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(Infinity===a.v)return this.nb$isnegative()?new Sk.builtin.nmber(-1,Sk.builtin.nmber.float$):new Sk.builtin.nmber(0,Sk.builtin.nmber.float$);if(-Infinity===a.v)return this.nb$isnegative()||
!this.nb$nonzero()?new Sk.builtin.nmber(0,Sk.builtin.nmber.float$):new Sk.builtin.nmber(-1,Sk.builtin.nmber.float$);b=new Sk.builtin.nmber(Math.floor(this.v/a.v),void 0);if(this.skType===Sk.builtin.nmber.float$||a.skType===Sk.builtin.nmber.float$)b.skType=Sk.builtin.nmber.float$;else if(b.v=Math.floor(b.v),b.skType=Sk.builtin.nmber.int$,b.v>Sk.builtin.nmber.threshold$||b.v<-Sk.builtin.nmber.threshold$)b=(new Sk.builtin.lng(this.v)).nb$floor_divide(a.v);return b}if(a instanceof Sk.builtin.lng){if(0==
a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");this.skType===Sk.builtin.nmber.float$?(b=Math.floor(this.v/parseFloat(a.str$(10,!0))),b=new Sk.builtin.nmber(b,Sk.builtin.nmber.float$)):b=(new Sk.builtin.lng(this.v)).nb$floor_divide(a);return b}};
Sk.builtin.nmber.prototype.nb$remainder=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.nmber(a,void 0));if(a instanceof Sk.builtin.nmber){if(0==a.v)throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(0==this.v)return this.skType==Sk.builtin.nmber.float$||a.skType==Sk.builtin.nmber.float$?new Sk.builtin.nmber(0,Sk.builtin.nmber.float$):new Sk.builtin.nmber(0,Sk.builtin.nmber.int$);if(Infinity===a.v)return Infinity===this.v||-Infinity===this.v?new Sk.builtin.nmber(NaN,
Sk.builtin.nmber.float$):this.nb$ispositive()?new Sk.builtin.nmber(this.v,Sk.builtin.nmber.float$):new Sk.builtin.nmber(Infinity,Sk.builtin.nmber.float$);b=this.v%a.v;0>this.v?0<a.v&&0>b&&(b+=a.v):0>a.v&&0!=b&&(b+=a.v);if(this.skType===Sk.builtin.nmber.float$||a.skType===Sk.builtin.nmber.float$)b=new Sk.builtin.nmber(b,Sk.builtin.nmber.float$);else if(b=new Sk.builtin.nmber(b,Sk.builtin.nmber.int$),b.v>Sk.builtin.nmber.threshold$||b.v<-Sk.builtin.nmber.threshold$)b=(new Sk.builtin.lng(this.v)).nb$remainder(a.v);
return b}if(a instanceof Sk.builtin.lng){if(0==a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.ZeroDivisionError("integer division or modulo by zero");if(0==this.v)return this.skType===Sk.builtin.nmber.int$?new Sk.builtin.lng(0):new Sk.builtin.nmber(0,this.skType);this.skType===Sk.builtin.nmber.float$?(a=parseFloat(a.str$(10,!0)),b=this.v%a,0>b?0<a&&0!=b&&(b+=a):0>a&&0!=b&&(b+=a),b=new Sk.builtin.nmber(b,Sk.builtin.nmber.float$)):b=(new Sk.builtin.lng(this.v)).nb$remainder(a);return b}};
Sk.builtin.nmber.prototype.nb$power=function(a){var b;"number"===typeof a&&(a=new Sk.builtin.nmber(a,void 0));if(a instanceof Sk.builtin.nmber){if(0>this.v&&0!=a.v%1)throw new Sk.builtin.NegativePowerError("cannot raise a negative number to a fractional power");if(0==this.v&&0>a.v)throw new Sk.builtin.NegativePowerError("cannot raise zero to a negative power");b=new Sk.builtin.nmber(Math.pow(this.v,a.v),void 0);if(this.skType===Sk.builtin.nmber.float$||a.skType===Sk.builtin.nmber.float$||0>a.v)b.skType=
Sk.builtin.nmber.float$;else if(b.v=Math.floor(b.v),b.skType=Sk.builtin.nmber.int$,b.v>Sk.builtin.nmber.threshold$||b.v<-Sk.builtin.nmber.threshold$)b=(new Sk.builtin.lng(this.v)).nb$power(a.v);if(Infinity===Math.abs(b.v)&&Infinity!==Math.abs(this.v)&&Infinity!==Math.abs(a.v))throw new Sk.builtin.OverflowError("Numerical result out of range");return b}if(a instanceof Sk.builtin.lng){if(0==this.v&&0>a.longCompare(Sk.builtin.biginteger.ZERO))throw new Sk.builtin.NegativePowerError("cannot raise zero to a negative power");
return b=this.skType===Sk.builtin.nmber.float$||a.nb$isnegative()?new Sk.builtin.nmber(Math.pow(this.v,parseFloat(a.str$(10,!0))),Sk.builtin.nmber.float$):(new Sk.builtin.lng(this.v)).nb$power(a)}};Sk.builtin.nmber.prototype.nb$and=function(a){a=Sk.builtin.asnum$(a);a&=this.v;void 0!==a&&0>a&&(a+=4294967296);if(void 0!==a)return new Sk.builtin.nmber(a,void 0)};
Sk.builtin.nmber.prototype.nb$or=function(a){a=Sk.builtin.asnum$(a);a|=this.v;void 0!==a&&0>a&&(a+=4294967296);if(void 0!==a)return new Sk.builtin.nmber(a,void 0)};Sk.builtin.nmber.prototype.nb$xor=function(a){a=Sk.builtin.asnum$(a);a^=this.v;void 0!==a&&0>a&&(a+=4294967296);if(void 0!==a)return new Sk.builtin.nmber(a,void 0)};
Sk.builtin.nmber.prototype.nb$lshift=function(a){var b;a=Sk.builtin.asnum$(a);if(void 0!==a){if(0>a)throw new Sk.builtin.ValueError("negative shift count");b=this.v<<a;if(b<=this.v)return Sk.builtin.lng.fromInt$(this.v).nb$lshift(a)}if(void 0!==b)return new Sk.builtin.nmber(b,this.skType)};
Sk.builtin.nmber.prototype.nb$rshift=function(a){var b;a=Sk.builtin.asnum$(a);if(void 0!==a){if(0>a)throw new Sk.builtin.ValueError("negative shift count");b=this.v>>a;0<this.v&&0>b&&(b&=Math.pow(2,32-a)-1)}if(void 0!==b)return new Sk.builtin.nmber(b,this.skType)};Sk.builtin.nmber.prototype.nb$inplace_add=Sk.builtin.nmber.prototype.nb$add;Sk.builtin.nmber.prototype.nb$inplace_subtract=Sk.builtin.nmber.prototype.nb$subtract;Sk.builtin.nmber.prototype.nb$inplace_multiply=Sk.builtin.nmber.prototype.nb$multiply;
Sk.builtin.nmber.prototype.nb$inplace_divide=Sk.builtin.nmber.prototype.nb$divide;Sk.builtin.nmber.prototype.nb$inplace_remainder=Sk.builtin.nmber.prototype.nb$remainder;Sk.builtin.nmber.prototype.nb$inplace_floor_divide=Sk.builtin.nmber.prototype.nb$floor_divide;Sk.builtin.nmber.prototype.nb$inplace_power=Sk.builtin.nmber.prototype.nb$power;Sk.builtin.nmber.prototype.nb$inplace_and=Sk.builtin.nmber.prototype.nb$and;Sk.builtin.nmber.prototype.nb$inplace_or=Sk.builtin.nmber.prototype.nb$or;
Sk.builtin.nmber.prototype.nb$inplace_xor=Sk.builtin.nmber.prototype.nb$xor;Sk.builtin.nmber.prototype.nb$inplace_lshift=Sk.builtin.nmber.prototype.nb$lshift;Sk.builtin.nmber.prototype.nb$inplace_rshift=Sk.builtin.nmber.prototype.nb$rshift;Sk.builtin.nmber.prototype.nb$negative=function(){return new Sk.builtin.nmber(-this.v,void 0)};Sk.builtin.nmber.prototype.nb$positive=function(){return this.clone()};Sk.builtin.nmber.prototype.nb$nonzero=function(){return 0!==this.v};
Sk.builtin.nmber.prototype.nb$isnegative=function(){return 0>this.v};Sk.builtin.nmber.prototype.nb$ispositive=function(){return 0<=this.v};
Sk.builtin.nmber.prototype.numberCompare=function(a){a instanceof Sk.builtin.bool&&(a=Sk.builtin.asnum$(a));a instanceof Sk.builtin.none&&(a=0);if("number"===typeof a)return this.v-a;if(a instanceof Sk.builtin.nmber)return Infinity==this.v&&Infinity==a.v||-Infinity==this.v&&-Infinity==a.v?0:this.v-a.v;if(a instanceof Sk.builtin.lng){if(this.skType===Sk.builtin.nmber.int$||0==this.v%1)return(new Sk.builtin.lng(this.v)).longCompare(a);a=this.nb$subtract(a);if(a instanceof Sk.builtin.nmber)return a.v;
if(a instanceof Sk.builtin.lng)return a.longCompare(Sk.builtin.biginteger.ZERO)}};Sk.builtin.nmber.prototype.__eq__=function(a,b){return 0==a.numberCompare(b)&&!(b instanceof Sk.builtin.none)};Sk.builtin.nmber.prototype.__ne__=function(a,b){return 0!=a.numberCompare(b)||b instanceof Sk.builtin.none};Sk.builtin.nmber.prototype.__lt__=function(a,b){return 0>a.numberCompare(b)};Sk.builtin.nmber.prototype.__le__=function(a,b){return 0>=a.numberCompare(b)};
Sk.builtin.nmber.prototype.__gt__=function(a,b){return 0<a.numberCompare(b)};Sk.builtin.nmber.prototype.__ge__=function(a,b){return 0<=a.numberCompare(b)};Sk.builtin.nmber.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.nmber.prototype.$r=function(){return new Sk.builtin.str(this.str$(10,!0))};Sk.builtin.nmber.prototype.tp$str=function(){return new Sk.builtin.str(this.str$(10,!0))};
Sk.builtin.nmber.prototype.str$=function(a,b){if(isNaN(this.v))return"nan";void 0===b&&(b=!0);if(Infinity==this.v)return"inf";if(-Infinity==this.v&&b)return"-inf";if(-Infinity==this.v&&!b)return"inf";var c=b?this.v:Math.abs(this.v),d;if(void 0===a||10===a)if(this.skType==Sk.builtin.nmber.float$){d=c.toPrecision(12);var e=d.indexOf("."),f=c.toString().slice(0,e),e=c.toString().slice(e);for(f.match(/^-?0$/)&&e.slice(1).match(/^0{4,}/)&&(d=12>d.length?c.toExponential():c.toExponential(11));"0"==d.charAt(d.length-
1)&&0>d.indexOf("e");)d=d.substring(0,d.length-1);"."==d.charAt(d.length-1)&&(d+="0");d=d.replace(/\.0+e/,"e","i");d=d.replace(/(e[-+])([1-9])$/,"$10$2");d=d.replace(/0+(e.*)/,"$1")}else d=c.toString();else d=c.toString(a);if(this.skType!==Sk.builtin.nmber.float$)return d;0>d.indexOf(".")&&(0>d.indexOf("E")&&0>d.indexOf("e"))&&(d+=".0");return d};goog.exportSymbol("Sk.builtin.nmber",Sk.builtin.nmber);Sk.builtin.lng=function(a,b){b=Sk.builtin.asnum$(b);if(!(this instanceof Sk.builtin.lng))return new Sk.builtin.lng(a,b);if(void 0===a)this.biginteger=new Sk.builtin.biginteger(0);else if(a instanceof Sk.builtin.lng)this.biginteger=a.biginteger.clone();else if(a instanceof Sk.builtin.biginteger)this.biginteger=a;else{if(a instanceof String)return Sk.longFromStr(a,b);if(a instanceof Sk.builtin.str)return Sk.longFromStr(a.v,b);if(void 0!==a&&!Sk.builtin.checkString(a)&&!Sk.builtin.checkNumber(a))if(!0===
a)a=1;else if(!1===a)a=0;else throw new Sk.builtin.TypeError("long() argument must be a string or a number, not '"+Sk.abstr.typeName(a)+"'");a=Sk.builtin.asnum$nofloat(a);this.biginteger=new Sk.builtin.biginteger(a)}return this};Sk.builtin.lng.prototype.tp$index=function(){return parseInt(this.str$(10,!0),10)};Sk.builtin.lng.prototype.tp$hash=function(){return this.tp$index()};Sk.builtin.lng.prototype.tp$name="long";Sk.builtin.lng.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("long",Sk.builtin.lng);
Sk.builtin.lng.threshold$=Math.pow(2,53);Sk.builtin.lng.MAX_INT$=new Sk.builtin.lng(Sk.builtin.lng.threshold$);Sk.builtin.lng.MIN_INT$=new Sk.builtin.lng(-Sk.builtin.lng.threshold$);Sk.builtin.lng.prototype.cantBeInt=function(){return 0<this.longCompare(Sk.builtin.lng.MAX_INT$)||0>this.longCompare(Sk.builtin.lng.MIN_INT$)};Sk.builtin.lng.fromInt$=function(a){return new Sk.builtin.lng(a)};
Sk.longFromStr=function(a,b){var c=Sk.str2number(a,b,function(a,b){return 10==b?new Sk.builtin.biginteger(a):new Sk.builtin.biginteger(a,b)},function(a){return a.negate()},"long");return new Sk.builtin.lng(c)};goog.exportSymbol("Sk.longFromStr",Sk.longFromStr);Sk.builtin.lng.prototype.toInt$=function(){return this.biginteger.intValue()};Sk.builtin.lng.prototype.clone=function(){return new Sk.builtin.lng(this)};
Sk.builtin.lng.prototype.nb$add=function(a){if(a instanceof Sk.builtin.nmber){if(a.skType===Sk.builtin.nmber.float$)return(new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$)).nb$add(a);a=new Sk.builtin.lng(a.v)}return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.add(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.add(a)):new Sk.builtin.lng(this.biginteger.add(new Sk.builtin.biginteger(a)))};
Sk.builtin.lng.prototype.nb$inplace_add=Sk.builtin.lng.prototype.nb$add;Sk.builtin.lng.prototype.nb$subtract=function(a){if(a instanceof Sk.builtin.nmber){if(a.skType===Sk.builtin.nmber.float$)return(new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$)).nb$subtract(a);a=new Sk.builtin.lng(a.v)}return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.subtract(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.subtract(a)):new Sk.builtin.lng(this.biginteger.subtract(new Sk.builtin.biginteger(a)))};
Sk.builtin.lng.prototype.nb$inplace_subtract=Sk.builtin.lng.prototype.nb$subtract;Sk.builtin.lng.prototype.nb$multiply=function(a){if(a instanceof Sk.builtin.nmber){if(a.skType===Sk.builtin.nmber.float$)return(new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$)).nb$multiply(a);a=new Sk.builtin.lng(a.v)}return a instanceof Sk.builtin.lng?new Sk.builtin.lng(this.biginteger.multiply(a.biginteger)):a instanceof Sk.builtin.biginteger?new Sk.builtin.lng(this.biginteger.multiply(a)):new Sk.builtin.lng(this.biginteger.multiply(new Sk.builtin.biginteger(a)))};
Sk.builtin.lng.prototype.nb$inplace_multiply=Sk.builtin.lng.prototype.nb$multiply;
Sk.builtin.lng.prototype.nb$divide=function(a){if(a instanceof Sk.builtin.nmber){if(a.skType===Sk.builtin.nmber.float$)return(new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$)).nb$divide(a);a=new Sk.builtin.lng(a.v)}a instanceof Sk.builtin.lng||(a=new Sk.builtin.lng(a));var b=this.nb$isnegative(),c=a.nb$isnegative();if(b&&!c||c&&!b){a=this.biginteger.divideAndRemainder(a.biginteger);if(0==a[1].trueCompare(Sk.builtin.biginteger.ZERO))return new Sk.builtin.lng(a[0]);a=a[0].subtract(Sk.builtin.biginteger.ONE);
return new Sk.builtin.lng(a)}return new Sk.builtin.lng(this.biginteger.divide(a.biginteger))};Sk.builtin.lng.prototype.nb$inplace_divide=Sk.builtin.lng.prototype.nb$divide;Sk.builtin.lng.prototype.nb$floor_divide=function(a){return a instanceof Sk.builtin.nmber&&a.skType===Sk.builtin.nmber.float$?(new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$)).nb$floor_divide(a):this.nb$divide(a)};Sk.builtin.lng.prototype.nb$inplace_floor_divide=Sk.builtin.lng.prototype.nb$floor_divide;
Sk.builtin.lng.prototype.nb$remainder=function(a){if(0===this.biginteger.trueCompare(Sk.builtin.biginteger.ZERO))return a instanceof Sk.builtin.nmber&&a.skType===Sk.builtin.nmber.float$?new Sk.builtin.nmber(0,Sk.builtin.nmber.float$):new Sk.builtin.lng(0);if(a instanceof Sk.builtin.nmber){if(a.skType===Sk.builtin.nmber.float$)return(new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$)).nb$remainder(a);a=new Sk.builtin.lng(a.v)}a instanceof Sk.builtin.lng||(a=new Sk.builtin.lng(a));var b=
new Sk.builtin.lng(this.biginteger.remainder(a.biginteger));this.nb$isnegative()?a.nb$ispositive()&&b.nb$nonzero()&&(b=b.nb$add(a).nb$remainder(a)):a.nb$isnegative()&&b.nb$nonzero()&&(b=b.nb$add(a));return b};Sk.builtin.lng.prototype.nb$inplace_remainder=Sk.builtin.lng.prototype.nb$remainder;
Sk.builtin.lng.prototype.nb$power=function(a,b){if(void 0!==b)return a=new Sk.builtin.biginteger(Sk.builtin.asnum$(a)),b=new Sk.builtin.biginteger(Sk.builtin.asnum$(b)),new Sk.builtin.lng(this.biginteger.modPowInt(a,b));if("number"===typeof a){if(0>a){var c=new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$);return c.nb$power(a)}return new Sk.builtin.lng(this.biginteger.pow(new Sk.builtin.biginteger(a)))}if(a instanceof Sk.builtin.nmber){if(a.skType===Sk.builtin.nmber.float$||0>a.v)return c=
new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$),c.nb$power(a);a=new Sk.builtin.lng(a.v)}return a instanceof Sk.builtin.lng?a.nb$isnegative()?(c=new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$),c.nb$power(a)):new Sk.builtin.lng(this.biginteger.pow(a.biginteger)):a instanceof Sk.builtin.biginteger?a.isnegative()?(c=new Sk.builtin.nmber(this.str$(10,!0),Sk.builtin.nmber.float$),c.nb$power(a)):new Sk.builtin.lng(this.biginteger.pow(a)):new Sk.builtin.lng(this.biginteger.pow(new Sk.builtin.biginteger(a)))};
Sk.builtin.lng.prototype.nb$inplace_power=Sk.builtin.lng.prototype.nb$power;
Sk.builtin.lng.prototype.nb$lshift=function(a){if(a instanceof Sk.builtin.lng){if(0>a.biginteger.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftLeft(a.biginteger))}if(a instanceof Sk.builtin.biginteger){if(0>a.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftLeft(a))}if(0>a)throw new Sk.builtin.ValueError("negative shift count");a=Sk.builtin.asnum$(a);return new Sk.builtin.lng(this.biginteger.shiftLeft(new Sk.builtin.biginteger(a)))};
Sk.builtin.lng.prototype.nb$inplace_lshift=Sk.builtin.lng.prototype.nb$lshift;
Sk.builtin.lng.prototype.nb$rshift=function(a){if(a instanceof Sk.builtin.lng){if(0>a.biginteger.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftRight(a.biginteger))}if(a instanceof Sk.builtin.biginteger){if(0>a.signum())throw new Sk.builtin.ValueError("negative shift count");return new Sk.builtin.lng(this.biginteger.shiftRight(a))}if(0>a)throw new Sk.builtin.ValueError("negative shift count");a=Sk.builtin.asnum$(a);return new Sk.builtin.lng(this.biginteger.shiftRight(new Sk.builtin.biginteger(a)))};
Sk.builtin.lng.prototype.nb$inplace_rshift=Sk.builtin.lng.prototype.nb$rshift;Sk.builtin.lng.prototype.nb$and=function(a){if(a instanceof Sk.builtin.lng)return new Sk.builtin.lng(this.biginteger.and(a.biginteger));if(a instanceof Sk.builtin.biginteger)return new Sk.builtin.lng(this.biginteger.and(a));a=Sk.builtin.asnum$(a);return new Sk.builtin.lng(this.biginteger.and(new Sk.builtin.biginteger(a)))};Sk.builtin.lng.prototype.nb$inplace_and=Sk.builtin.lng.prototype.nb$and;
Sk.builtin.lng.prototype.nb$or=function(a){if(a instanceof Sk.builtin.lng)return new Sk.builtin.lng(this.biginteger.or(a.biginteger));if(a instanceof Sk.builtin.biginteger)return new Sk.builtin.lng(this.biginteger.or(a));a=Sk.builtin.asnum$(a);return new Sk.builtin.lng(this.biginteger.or(new Sk.builtin.biginteger(a)))};Sk.builtin.lng.prototype.nb$inplace_or=Sk.builtin.lng.prototype.nb$or;
Sk.builtin.lng.prototype.nb$xor=function(a){if(a instanceof Sk.builtin.lng)return new Sk.builtin.lng(this.biginteger.xor(a.biginteger));if(a instanceof Sk.builtin.biginteger)return new Sk.builtin.lng(this.biginteger.xor(a));a=Sk.builtin.asnum$(a);return new Sk.builtin.lng(this.biginteger.xor(new Sk.builtin.biginteger(a)))};Sk.builtin.lng.prototype.nb$inplace_xor=Sk.builtin.lng.prototype.nb$xor;Sk.builtin.lng.prototype.nb$negative=function(){return new Sk.builtin.lng(this.biginteger.negate())};
Sk.builtin.lng.prototype.nb$positive=function(){return this.clone()};Sk.builtin.lng.prototype.nb$nonzero=function(){return 0!==this.biginteger.trueCompare(Sk.builtin.biginteger.ZERO)};Sk.builtin.lng.prototype.nb$isnegative=function(){return this.biginteger.isnegative()};Sk.builtin.lng.prototype.nb$ispositive=function(){return!this.biginteger.isnegative()};
Sk.builtin.lng.prototype.longCompare=function(a){"boolean"===typeof a&&(a=a?1:0);"number"===typeof a&&(a=new Sk.builtin.lng(a));return a instanceof Sk.builtin.nmber?a.skType===Sk.builtin.nmber.int$||0==a.v%1?(a=new Sk.builtin.lng(a.v),this.longCompare(a)):(new Sk.builtin.nmber(this,Sk.builtin.nmber.float$)).numberCompare(a):a instanceof Sk.builtin.lng?this.biginteger.subtract(a.biginteger):a instanceof Sk.builtin.biginteger?this.biginteger.subtract(a):this.biginteger.subtract(new Sk.builtin.biginteger(a))};
Sk.builtin.lng.prototype.__eq__=function(a,b){return 0==a.longCompare(b)&&!(b instanceof Sk.builtin.none)};Sk.builtin.lng.prototype.__ne__=function(a,b){return 0!=a.longCompare(b)||b instanceof Sk.builtin.none};Sk.builtin.lng.prototype.__lt__=function(a,b){return 0>a.longCompare(b)};Sk.builtin.lng.prototype.__le__=function(a,b){return 0>=a.longCompare(b)};Sk.builtin.lng.prototype.__gt__=function(a,b){return 0<a.longCompare(b)};Sk.builtin.lng.prototype.__ge__=function(a,b){return 0<=a.longCompare(b)};
Sk.builtin.lng.prototype.$r=function(){return new Sk.builtin.str(this.str$(10,!0)+"L")};Sk.builtin.lng.prototype.tp$str=function(){return new Sk.builtin.str(this.str$(10,!0))};Sk.builtin.lng.prototype.str$=function(a,b){void 0===b&&(b=!0);var c=b?this.biginteger:this.biginteger.abs();return void 0===a||10===a?c.toString():c.toString(a)};Sk.str2number=function(a,b,c,d,e){var f=a,g=!1;a=a.replace(/^\s+|\s+$/g,"");"-"==a.charAt(0)&&(g=!0,a=a.substring(1));"+"==a.charAt(0)&&(a=a.substring(1));void 0===b&&(b=10);if((2>b||36<b)&&0!=b)throw new Sk.builtin.ValueError(e+"() base must be >= 2 and <= 36");if("0x"==a.substring(0,2).toLowerCase()){if(16!=b&&0!=b)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");a=a.substring(2);b=16}else if("0b"==a.substring(0,2).toLowerCase()){if(2!=b&&0!=b)throw new Sk.builtin.ValueError("invalid literal for "+
e+"() with base "+b+": '"+f+"'");a=a.substring(2);b=2}else if("0o"==a.substring(0,2).toLowerCase()){if(8!=b&&0!=b)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");a=a.substring(2);b=8}else if("0"==a.charAt(0)){if("0"==a)return 0;if(8==b||0==b)b=8}0==b&&(b=10);if(0===a.length)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");var h,k,l;for(h=0;h<a.length;h++)if(k=a.charCodeAt(h),l=b,48<=k&&57>=k?l=k-48:65<=k&&90>=k?l=k-65+
10:97<=k&&122>=k&&(l=k-97+10),l>=b)throw new Sk.builtin.ValueError("invalid literal for "+e+"() with base "+b+": '"+f+"'");l=c(a,b);g&&(l=d(l));return l};
Sk.builtin.int_=function(a,b){if(void 0!==a&&!Sk.builtin.checkString(a)&&!Sk.builtin.checkNumber(a))if(a instanceof Sk.builtin.bool)a=Sk.builtin.asnum$(a);else throw new Sk.builtin.TypeError("int() argument must be a string or a number, not '"+Sk.abstr.typeName(a)+"'");if(a instanceof Sk.builtin.str){b=Sk.builtin.asnum$(b);var c=Sk.str2number(a.v,b,parseInt,function(a){return-a},"int");return c>Sk.builtin.lng.threshold$||c<-Sk.builtin.lng.threshold$?new Sk.builtin.lng(a,b):new Sk.builtin.nmber(c,
Sk.builtin.nmber.int$)}if(void 0!==b)throw new Sk.builtin.TypeError("int() can't convert non-string with explicit base");if(a instanceof Sk.builtin.lng)return a.cantBeInt()?new Sk.builtin.lng(a):new Sk.builtin.nmber(a.toInt$(),Sk.builtin.nmber.int$);a=Sk.builtin.asnum$(a);return new Sk.builtin.nmber(a|0,Sk.builtin.nmber.int$)};Sk.builtin.int_.prototype.tp$name="int";Sk.builtin.int_.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("int",Sk.builtin.int_);Sk.builtin.float_=function(a){if(void 0===a)return new Sk.builtin.nmber(0,Sk.builtin.nmber.float$);if(a instanceof Sk.builtin.str){if(a.v.match(/^-inf$/i))a=-Infinity;else if(a.v.match(/^[+]?inf$/i))a=Infinity;else if(a.v.match(/^[-+]?nan$/i))a=NaN;else{if(isNaN(a.v))throw new Sk.builtin.ValueError("float: Argument: "+a.v+" is not number");a=parseFloat(a.v)}return new Sk.builtin.nmber(a,Sk.builtin.nmber.float$)}if("number"===typeof a||a instanceof Sk.builtin.nmber||a instanceof Sk.builtin.lng)return a=
Sk.builtin.asnum$(a),new Sk.builtin.nmber(a,Sk.builtin.nmber.float$);if(a instanceof Sk.builtin.bool)return a=Sk.builtin.asnum$(a),new Sk.builtin.nmber(a,Sk.builtin.nmber.float$);throw new Sk.builtin.TypeError("float() argument must be a string or a number");};Sk.builtin.float_.prototype.tp$name="float";Sk.builtin.float_.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("float",Sk.builtin.float_);Sk.builtin.slice=function(a,b,c){a=Sk.builtin.asnum$(a);b=Sk.builtin.asnum$(b);c=Sk.builtin.asnum$(c);if(!(this instanceof Sk.builtin.slice))return new Sk.builtin.slice(a,b,c);void 0===b&&void 0===c&&(b=a,a=null);a||(a=null);void 0===b&&(b=null);void 0===c&&(c=null);this.start=a;this.stop=b;this.step=c;if(null!==this.start&&!Sk.builtin.checkInt(this.start)||null!==this.stop&&!Sk.builtin.checkInt(this.stop)||null!==this.step&&!Sk.builtin.checkInt(this.step))throw new Sk.builtin.TypeError("slice indices must be integers or None");
return this};Sk.builtin.slice.prototype.tp$str=function(){var a=Sk.builtin.repr(this.start).v,b=Sk.builtin.repr(this.stop).v,c=Sk.builtin.repr(this.step).v;return new Sk.builtin.str("slice("+a+", "+b+", "+c+")")};
Sk.builtin.slice.prototype.indices=function(a){a=Sk.builtin.asnum$(a);var b=this.start,c=this.stop,d=this.step;null===d&&(d=1);0<d?(null===b&&(b=0),null===c&&(c=a),c>a&&(c=a),0>b&&(b=a+b,0>b&&(b=0)),0>c&&(c=a+c)):(null===b&&(b=a-1),b>=a&&(b=a-1),null===c?c=-1:0>c&&(c=a+c,0>c&&(c=-1)),0>b&&(b=a+b));return[b,c,d]};
Sk.builtin.slice.prototype.sssiter$=function(a,b){var c=Sk.builtin.asnum$(a),d=this.indices("number"===typeof c?c:a.v.length);if(0<d[2]){var e;for(e=d[0];e<d[1]&&!1!==b(e,c);e+=d[2]);}else for(e=d[0];e>d[1]&&!1!==b(e,c);e+=d[2]);};Sk.builtin.set=function(a){if(!(this instanceof Sk.builtin.set))return new Sk.builtin.set(a);"undefined"===typeof a&&(a=[]);this.set_reset_();a=(new Sk.builtin.list(a)).tp$iter();for(var b=a.tp$iternext();void 0!==b;b=a.tp$iternext())Sk.builtin.set.prototype.add.func_code(this,b);this.__class__=Sk.builtin.set;this.v=this.v;return this};Sk.builtin.set.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("set",Sk.builtin.set);Sk.builtin.set.prototype.set_iter_=function(){return Sk.builtin.dict.prototype.keys.func_code(this.v).tp$iter()};
Sk.builtin.set.prototype.set_reset_=function(){this.v=new Sk.builtin.dict([])};Sk.builtin.set.prototype.tp$name="set";Sk.builtin.set.prototype.$r=function(){for(var a=[],b=this.tp$iter(),c=b.tp$iternext();void 0!==c;c=b.tp$iternext())a.push(Sk.misceval.objectRepr(c).v);return new Sk.builtin.str("set(["+a.join(", ")+"])")};Sk.builtin.set.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.set.prototype.tp$hash=Sk.builtin.object.prototype.HashNotImplemented;
Sk.builtin.set.prototype.tp$richcompare=function(a,b){if(this===a&&Sk.misceval.opAllowsEquality(b))return!0;if(!a.__class__||a.__class__!=Sk.builtin.set)return"Eq"===b?!1:"NotEq"===b?!0:!1;var c=this.sq$length(),d=a.sq$length();if(d!==c){if("Eq"===b)return!1;if("NotEq"===b)return!0}var e=!1,f=!1;switch(b){case "Lt":case "LtE":case "Eq":case "NotEq":e=Sk.builtin.set.prototype.issubset.func_code(this,a);break;case "Gt":case "GtE":f=Sk.builtin.set.prototype.issuperset.func_code(this,a);break;default:goog.asserts.fail()}switch(b){case "Lt":return c<
d&&e;case "LtE":case "Eq":return e;case "NotEq":return!e;case "Gt":return c>d&&f;case "GtE":return f}};Sk.builtin.set.prototype.tp$iter=Sk.builtin.set.prototype.set_iter_;Sk.builtin.set.prototype.sq$length=function(){return this.v.mp$length()};Sk.builtin.set.prototype.isdisjoint=new Sk.builtin.func(function(a,b){for(var c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())if(Sk.abstr.sequenceContains(b,d))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$});
Sk.builtin.set.prototype.issubset=new Sk.builtin.func(function(a,b){var c=a.sq$length(),d=b.sq$length();if(c>d)return Sk.builtin.bool.false$;c=a.tp$iter();for(d=c.tp$iternext();void 0!==d;d=c.tp$iternext())if(!Sk.abstr.sequenceContains(b,d))return Sk.builtin.bool.false$;return Sk.builtin.bool.true$});Sk.builtin.set.prototype.issuperset=new Sk.builtin.func(function(a,b){return Sk.builtin.set.prototype.issubset.func_code(b,a)});
Sk.builtin.set.prototype.union=new Sk.builtin.func(function(a){for(var b=new Sk.builtin.set(a),c=1;c<arguments.length;c++)Sk.builtin.set.prototype.update.func_code(b,arguments[c]);return b});Sk.builtin.set.prototype.intersection=new Sk.builtin.func(function(a){var b=Sk.builtin.set.prototype.copy.func_code(a);arguments[0]=b;Sk.builtin.set.prototype.intersection_update.func_code.apply(null,arguments);return b});
Sk.builtin.set.prototype.difference=new Sk.builtin.func(function(a,b){var c=Sk.builtin.set.prototype.copy.func_code(a);arguments[0]=c;Sk.builtin.set.prototype.difference_update.func_code.apply(null,arguments);return c});
Sk.builtin.set.prototype.symmetric_difference=new Sk.builtin.func(function(a,b){for(var c=Sk.builtin.set.prototype.union.func_code(a,b),d=c.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())Sk.abstr.sequenceContains(a,e)&&Sk.abstr.sequenceContains(b,e)&&Sk.builtin.set.prototype.discard.func_code(c,e);return c});Sk.builtin.set.prototype.copy=new Sk.builtin.func(function(a){return new Sk.builtin.set(a)});
Sk.builtin.set.prototype.update=new Sk.builtin.func(function(a,b){for(var c=b.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())Sk.builtin.set.prototype.add.func_code(a,d);return Sk.builtin.none.none$});Sk.builtin.set.prototype.intersection_update=new Sk.builtin.func(function(a,b){for(var c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())for(var e=1;e<arguments.length;e++)if(!Sk.abstr.sequenceContains(arguments[e],d)){Sk.builtin.set.prototype.discard.func_code(a,d);break}return Sk.builtin.none.none$});
Sk.builtin.set.prototype.difference_update=new Sk.builtin.func(function(a,b){for(var c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext())for(var e=1;e<arguments.length;e++)if(Sk.abstr.sequenceContains(arguments[e],d)){Sk.builtin.set.prototype.discard.func_code(a,d);break}return Sk.builtin.none.none$});
Sk.builtin.set.prototype.symmetric_difference_update=new Sk.builtin.func(function(a,b){var c=Sk.builtin.set.prototype.symmetric_difference.func_code(a,b);a.set_reset_();Sk.builtin.set.prototype.update.func_code(a,c);return Sk.builtin.none.none$});Sk.builtin.set.prototype.add=new Sk.builtin.func(function(a,b){a.v.mp$ass_subscript(b,!0);return Sk.builtin.none.none$});
Sk.builtin.set.prototype.discard=new Sk.builtin.func(function(a,b){if(void 0!==a.v.mp$lookup(b)){var c=Sk.builtin.hash,c=c(b);void 0!==a.v[c]&&(a.v.size-=1,delete a.v[c])}return Sk.builtin.none.none$});Sk.builtin.set.prototype.pop=new Sk.builtin.func(function(a){if(0===a.sq$length())throw new Sk.builtin.KeyError("pop from an empty set");var b=a.tp$iter().tp$iternext();Sk.builtin.set.prototype.discard.func_code(a,b);return b});
Sk.builtin.set.prototype.remove=new Sk.builtin.func(function(a,b){a.v.mp$del_subscript(b);return Sk.builtin.none.none$});goog.exportSymbol("Sk.builtin.set",Sk.builtin.set);Sk.builtin.module=function(){};goog.exportSymbol("Sk.builtin.module",Sk.builtin.module);Sk.builtin.module.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("module",Sk.builtin.module);Sk.builtin.module.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.module.prototype.tp$setattr=Sk.builtin.object.prototype.GenericSetAttr;Sk.builtin.generator=function(a,b,c,d,e){if(a){this.func_code=a;this.func_globals=b||null;this.gi$running=!1;this.gi$resumeat=0;this.gi$sentvalue=void 0;this.gi$locals={};if(0<c.length)for(b=0;b<a.co_varnames.length;++b)this.gi$locals[a.co_varnames[b]]=c[b];if(void 0!==e)for(var f in e)d[f]=e[f];this.func_closure=d;return this}};goog.exportSymbol("Sk.builtin.generator",Sk.builtin.generator);Sk.builtin.generator.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;
Sk.builtin.generator.prototype.tp$iter=function(){return this};Sk.builtin.generator.prototype.tp$iternext=function(a){this.gi$running=!0;void 0===a&&(a=null);this.gi$sentvalue=a;a=[this];this.func_closure&&a.push(this.func_closure);a=this.func_code.apply(this.func_globals,a);this.gi$running=!1;goog.asserts.assert(void 0!==a);if(null!==a)return this.gi$resumeat=a[0],a=a[1]};Sk.builtin.generator.prototype.next=new Sk.builtin.func(function(a){return a.tp$iternext()});
Sk.builtin.generator.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("generator",Sk.builtin.generator);Sk.builtin.generator.prototype.$r=function(){return new Sk.builtin.str("<generator object "+this.func_code.co_name.v+">")};Sk.builtin.generator.prototype.send=new Sk.builtin.func(function(a,b){return a.tp$iternext(b)});Sk.builtin.makeGenerator=function(a,b){var c=new Sk.builtin.generator(null,null,null);c.tp$iternext=a;for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c};
goog.exportSymbol("Sk.builtin.makeGenerator",Sk.builtin.makeGenerator);Sk.builtin.file=function(a,b,c){this.mode=b;this.name=a;this.closed=!1;if(Sk.inBrowser){b=document.getElementById(a.v);if(null==b)throw new Sk.builtin.IOError("[Errno 2] No such file or directory: '"+a.v+"'");"textarea"==b.nodeName.toLowerCase()?this.data$=b.value:this.data$=b.textContent}else this.data$=Sk.read(a.v);this.lineList=this.data$.split("\n");this.lineList=this.lineList.slice(0,-1);for(var d in this.lineList)this.lineList[d]+="\n";this.pos$=this.currentLine=0;this.__class__=Sk.builtin.file;
return this};Sk.builtin.file.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("file",Sk.builtin.file);Sk.builtin.file.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.file.prototype.$r=function(){return new Sk.builtin.str("<"+(this.closed?"closed":"open")+"file '"+this.name+"', mode '"+this.mode+"'>")};
Sk.builtin.file.prototype.tp$iter=function(){var a={tp$iter:function(){return a},$obj:this,$index:0,$lines:this.lineList,tp$iternext:function(){return a.$index>=a.$lines.length?void 0:new Sk.builtin.str(a.$lines[a.$index++])}};return a};Sk.builtin.file.prototype.close=new Sk.builtin.func(function(a){a.closed=!0});Sk.builtin.file.prototype.flush=new Sk.builtin.func(function(a){});Sk.builtin.file.prototype.fileno=new Sk.builtin.func(function(a){return 10});Sk.builtin.file.prototype.isatty=new Sk.builtin.func(function(a){return!1});
Sk.builtin.file.prototype.read=new Sk.builtin.func(function(a,b){if(a.closed)throw new Sk.builtin.ValueError("I/O operation on closed file");var c=a.data$.length;void 0===b&&(b=c);var d=new Sk.builtin.str(a.data$.substr(a.pos$,b));a.pos$+=b;a.pos$>=c&&(a.pos$=c);return d});Sk.builtin.file.prototype.readline=new Sk.builtin.func(function(a,b){var c="";a.currentLine<a.lineList.length&&(c=a.lineList[a.currentLine],a.currentLine++);return new Sk.builtin.str(c)});
Sk.builtin.file.prototype.readlines=new Sk.builtin.func(function(a,b){for(var c=[],d=a.currentLine;d<a.lineList.length;d++)c.push(new Sk.builtin.str(a.lineList[d]));return new Sk.builtin.list(c)});Sk.builtin.file.prototype.seek=new Sk.builtin.func(function(a,b,c){void 0===c&&(c=1);a.pos$=1==c?b:a.data$+b});Sk.builtin.file.prototype.tell=new Sk.builtin.func(function(a){return a.pos$});Sk.builtin.file.prototype.truncate=new Sk.builtin.func(function(a,b){goog.asserts.fail()});
Sk.builtin.file.prototype.write=new Sk.builtin.func(function(a,b){goog.asserts.fail()});goog.exportSymbol("Sk.builtin.file",Sk.builtin.file);Sk.ffi=Sk.ffi||{};
Sk.ffi.remapToPy=function(a){if("[object Array]"===Object.prototype.toString.call(a)){for(var b=[],c=0;c<a.length;++c)b.push(Sk.ffi.remapToPy(a[c]));return new Sk.builtin.list(b)}if("object"===typeof a){b=[];for(c in a)b.push(Sk.ffi.remapToPy(c)),b.push(Sk.ffi.remapToPy(a[c]));return new Sk.builtin.dict(b)}if("string"===typeof a)return new Sk.builtin.str(a);if("number"===typeof a)return new Sk.builtin.nmber(a,void 0);if("boolean"===typeof a)return a;goog.asserts.fail("unhandled remap type "+typeof a)};
goog.exportSymbol("Sk.ffi.remapToPy",Sk.ffi.remapToPy);
Sk.ffi.remapToJs=function(a){if(a instanceof Sk.builtin.dict){for(var b={},c=a.tp$iter(),d=c.tp$iternext();void 0!==d;d=c.tp$iternext()){var e=a.mp$subscript(d);void 0===e&&(e=null);d=Sk.ffi.remapToJs(d);b[d]=Sk.ffi.remapToJs(e)}return b}if(a instanceof Sk.builtin.list){b=[];for(c=0;c<a.v.length;++c)b.push(Sk.ffi.remapToJs(a.v[c]));return b}return a instanceof Sk.builtin.nmber?Sk.builtin.asnum$(a):a instanceof Sk.builtin.lng?Sk.builtin.asnum$(a):"number"===typeof a||"boolean"===typeof a?a:a.v};
goog.exportSymbol("Sk.ffi.remapToJs",Sk.ffi.remapToJs);Sk.ffi.callback=function(a){return void 0===a?a:function(){return Sk.misceval.apply(a,void 0,void 0,void 0,Array.prototype.slice.call(arguments,0))}};goog.exportSymbol("Sk.ffi.callback",Sk.ffi.callback);Sk.ffi.stdwrap=function(a,b){var c=new a;c.v=b;return c};goog.exportSymbol("Sk.ffi.stdwrap",Sk.ffi.stdwrap);
Sk.ffi.basicwrap=function(a){if(a instanceof Sk.builtin.nmber)return Sk.builtin.asnum$(a);if(a instanceof Sk.builtin.lng)return Sk.builtin.asnum$(a);if("number"===typeof a||"boolean"===typeof a)return a;if("string"===typeof a)return new Sk.builtin.str(a);goog.asserts.fail("unexpected type for basicwrap")};goog.exportSymbol("Sk.ffi.basicwrap",Sk.ffi.basicwrap);Sk.ffi.unwrapo=function(a){return void 0===a?void 0:a.v};goog.exportSymbol("Sk.ffi.unwrapo",Sk.ffi.unwrapo);
Sk.ffi.unwrapn=function(a){return null===a?null:a.v};goog.exportSymbol("Sk.ffi.unwrapn",Sk.ffi.unwrapn);Sk.builtin.enumerate=function(a,b){if(!(this instanceof Sk.builtin.enumerate))return new Sk.builtin.enumerate(a,b);Sk.builtin.pyCheckArgs("enumerate",arguments,1,2);if(!Sk.builtin.checkIterable(a))throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(a)+"' object is not iterable");if(void 0!==b)if(Sk.misceval.isIndex(b))b=Sk.misceval.asIndex(b);else throw new Sk.builtin.TypeError("'"+Sk.abstr.typeName(b)+"' object cannot be interpreted as an index");else b=0;var c=a.tp$iter();this.tp$iter=function(){return this};
this.$index=b;this.tp$iternext=function(){var a=c.tp$iternext();return void 0===a?void 0:new Sk.builtin.tuple([this.$index++,a])};this.__class__=Sk.builtin.enumerate;return this};Sk.builtin.enumerate.prototype.tp$name="enumerate";Sk.builtin.enumerate.prototype.ob$type=Sk.builtin.type.makeIntoTypeObj("enumerate",Sk.builtin.enumerate);Sk.builtin.enumerate.prototype.tp$getattr=Sk.builtin.object.prototype.GenericGetAttr;Sk.builtin.enumerate.prototype.__iter__=new Sk.builtin.func(function(a){return a.tp$iter()});
Sk.builtin.enumerate.prototype.next=new Sk.builtin.func(function(a){return a.tp$iternext()});Sk.Tokenizer=function(a,b,c){this.filename=a;this.callback=c;this.parenlev=this.lnum=0;this.continued=!1;this.namechars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";this.numchars="0123456789";this.contstr="";this.needcont=!1;this.contline=void 0;this.indents=[0];this.endprog=/.*/;this.strstart=[-1,-1];this.interactive=b;this.doneFunc=function(){for(var a=1;a<this.indents.length;++a)if(this.callback(Sk.Tokenizer.Tokens.T_DEDENT,"",[this.lnum,0],[this.lnum,0],""))return"done";return this.callback(Sk.Tokenizer.Tokens.T_ENDMARKER,
"",[this.lnum,0],[this.lnum,0],"")?"done":"failed"}};
Sk.Tokenizer.Tokens={T_ENDMARKER:0,T_NAME:1,T_NUMBER:2,T_STRING:3,T_NEWLINE:4,T_INDENT:5,T_DEDENT:6,T_LPAR:7,T_RPAR:8,T_LSQB:9,T_RSQB:10,T_COLON:11,T_COMMA:12,T_SEMI:13,T_PLUS:14,T_MINUS:15,T_STAR:16,T_SLASH:17,T_VBAR:18,T_AMPER:19,T_LESS:20,T_GREATER:21,T_EQUAL:22,T_DOT:23,T_PERCENT:24,T_BACKQUOTE:25,T_LBRACE:26,T_RBRACE:27,T_EQEQUAL:28,T_NOTEQUAL:29,T_LESSEQUAL:30,T_GREATEREQUAL:31,T_TILDE:32,T_CIRCUMFLEX:33,T_LEFTSHIFT:34,T_RIGHTSHIFT:35,T_DOUBLESTAR:36,T_PLUSEQUAL:37,T_MINEQUAL:38,T_STAREQUAL:39,
T_SLASHEQUAL:40,T_PERCENTEQUAL:41,T_AMPEREQUAL:42,T_VBAREQUAL:43,T_CIRCUMFLEXEQUAL:44,T_LEFTSHIFTEQUAL:45,T_RIGHTSHIFTEQUAL:46,T_DOUBLESTAREQUAL:47,T_DOUBLESLASH:48,T_DOUBLESLASHEQUAL:49,T_AT:50,T_OP:51,T_COMMENT:52,T_NL:53,T_RARROW:54,T_ERRORTOKEN:55,T_N_TOKENS:56,T_NT_OFFSET:256};function group(a){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function any(a){return group.apply(null,arguments)+"*"}function maybe(a){return group.apply(null,arguments)+"?"}
var Whitespace="[ \\f\\t]*",Comment_="#[^\\r\\n]*",Ident="[a-zA-Z_]\\w*",Binnumber="0[bB][01]*",Hexnumber="0[xX][\\da-fA-F]*[lL]?",Octnumber="0[oO]?[0-7]*[lL]?",Decnumber="[1-9]\\d*[lL]?",Intnumber=group(Binnumber,Hexnumber,Octnumber,Decnumber),Exponent="[eE][-+]?\\d+",Pointfloat=group("\\d+\\.\\d*","\\.\\d+")+maybe(Exponent),Expfloat="\\d+"+Exponent,Floatnumber=group(Pointfloat,Expfloat),Imagnumber=group("\\d+[jJ]",Floatnumber+"[jJ]"),Number_=group(Imagnumber,Floatnumber,Intnumber),Single="^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'",
Double_='^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',Single3="[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''",Double3='[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""',Triple=group("[ubUB]?[rR]?'''",'[ubUB]?[rR]?"""'),String_=group("[uU]?[rR]?'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'",'[uU]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*"'),Operator=group("\\*\\*=?",">>=?","<<=?","<>","!=","//=?","->","[+\\-*/%&|^=<>]=?","~"),Bracket="[\\][(){}]",Special=group("\\r?\\n","[:;.,`@]"),Funny=group(Operator,Bracket,Special),ContStr=
group("[uUbB]?[rR]?'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+group("'","\\\\\\r?\\n"),'[uUbB]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+group('"',"\\\\\\r?\\n")),PseudoExtras=group("\\\\\\r?\\n",Comment_,Triple),PseudoToken="^"+group(PseudoExtras,Number_,Funny,ContStr,Ident),pseudoprog,single3prog,double3prog,endprogs={},triple_quoted={"'''":!0,'"""':!0,"r'''":!0,'r"""':!0,"R'''":!0,'R"""':!0,"u'''":!0,'u"""':!0,"U'''":!0,'U"""':!0,"b'''":!0,'b"""':!0,"B'''":!0,'B"""':!0,"ur'''":!0,'ur"""':!0,"Ur'''":!0,
'Ur"""':!0,"uR'''":!0,'uR"""':!0,"UR'''":!0,'UR"""':!0,"br'''":!0,'br"""':!0,"Br'''":!0,'Br"""':!0,"bR'''":!0,'bR"""':!0,"BR'''":!0,'BR"""':!0},single_quoted={"'":!0,'"':!0,"r'":!0,'r"':!0,"R'":!0,'R"':!0,"u'":!0,'u"':!0,"U'":!0,'U"':!0,"b'":!0,'b"':!0,"B'":!0,'B"':!0,"ur'":!0,'ur"':!0,"Ur'":!0,'Ur"':!0,"uR'":!0,'uR"':!0,"UR'":!0,'UR"':!0,"br'":!0,'br"':!0,"Br'":!0,'Br"':!0,"bR'":!0,'bR"':!0,"BR'":!0,'BR"':!0};(function(){for(var a in triple_quoted);for(a in single_quoted);})();var tabsize=8;
function contains(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1}function rstrip(a,b){for(var c=a.length;0<c&&-1!==b.indexOf(a.charAt(c-1));--c);return a.substring(0,c)}
Sk.Tokenizer.prototype.generateTokens=function(a){var b,c,d,e,f,g=RegExp(PseudoToken);c=RegExp(Single3,"g");f=RegExp(Double3,"g");var h={"'":RegExp(Single,"g"),'"':RegExp(Double_,"g"),"'''":c,'"""':f,"r'''":c,'r"""':f,"u'''":c,'u"""':f,"b'''":c,'b"""':f,"ur'''":c,'ur"""':f,"br'''":c,'br"""':f,"R'''":c,'R"""':f,"U'''":c,'U"""':f,"B'''":c,'B"""':f,"uR'''":c,'uR"""':f,"Ur'''":c,'Ur"""':f,"UR'''":c,'UR"""':f,"bR'''":c,'bR"""':f,"Br'''":c,'Br"""':f,"BR'''":c,'BR"""':f,r:null,R:null,u:null,U:null,b:null,
B:null};a||(a="");this.lnum+=1;c=0;f=a.length;if(0<this.contstr.length){if(!a)throw new Sk.builtin.TokenError("EOF in multi-line string",this.filename,this.strstart[0],this.strstart[1],this.contline);this.endprog.lastIndex=0;if(b=this.endprog.test(a)){c=e=this.endprog.lastIndex;if(this.callback(Sk.Tokenizer.Tokens.T_STRING,this.contstr+a.substring(0,e),this.strstart,[this.lnum,e],this.contline+a))return"done";this.contstr="";this.needcont=!1;this.contline=void 0}else{if(this.needcont&&"\\\n"!==a.substring(a.length-
2)&&"\\\r\n"!==a.substring(a.length-3)){if(this.callback(Sk.Tokenizer.Tokens.T_ERRORTOKEN,this.contstr+a,this.strstart,[this.lnum,a.length],this.contline))return"done";this.contstr="";this.contline=void 0}else this.contstr+=a,this.contline+=a;return!1}}else if(0!==this.parenlev||this.continued){if(!a)throw new Sk.builtin.TokenError("EOF in multi-line statement",this.filename,this.lnum,0,a);this.continued=!1}else{if(!a)return this.doneFunc();for(d=0;c<f;){if(" "===a.charAt(c))d+=1;else if("\t"===a.charAt(c))d=
(d/tabsize+1)*tabsize;else if("\f"===a.charAt(c))d=0;else break;c+=1}if(c===f)return this.doneFunc();if(-1!=="#\r\n".indexOf(a.charAt(c))){if("#"===a.charAt(c))return g=rstrip(a.substring(c),"\r\n"),f=c+g.length,this.callback(Sk.Tokenizer.Tokens.T_COMMENT,g,[this.lnum,c],[this.lnum,c+g.length],a)||this.callback(Sk.Tokenizer.Tokens.T_NL,a.substring(f),[this.lnum,f],[this.lnum,a.length],a)?"done":!1;if(this.callback(Sk.Tokenizer.Tokens.T_NL,a.substring(c),[this.lnum,c],[this.lnum,a.length],a))return"done";
if(!this.interactive)return!1}if(d>this.indents[this.indents.length-1]&&(this.indents.push(d),this.callback(Sk.Tokenizer.Tokens.T_INDENT,a.substring(0,c),[this.lnum,0],[this.lnum,c],a)))return"done";for(;d<this.indents[this.indents.length-1];){if(!contains(this.indents,d))throw new Sk.builtin.IndentationError("unindent does not match any outer indentation level",this.filename,this.lnum,c,a);this.indents.splice(this.indents.length-1,1);if(this.callback(Sk.Tokenizer.Tokens.T_DEDENT,"",[this.lnum,c],
[this.lnum,c],a))return"done"}}for(;c<f;){for(d=a.charAt(c);" "===d||"\f"===d||"\t"===d;)c+=1,d=a.charAt(c);g.lastIndex=0;var k=g.exec(a.substring(c));if(k){d=c;e=d+k[1].length;k=[this.lnum,d];b=[this.lnum,e];c=e;e=a.substring(d,e);var l=a.charAt(d);if(-1!==this.numchars.indexOf(l)||"."===l&&"."!==e){if(this.callback(Sk.Tokenizer.Tokens.T_NUMBER,e,k,b,a))return"done"}else if("\r"===l||"\n"===l){if(d=Sk.Tokenizer.Tokens.T_NEWLINE,0<this.parenlev&&(d=Sk.Tokenizer.Tokens.T_NL),this.callback(d,e,k,b,
a))return"done"}else if("#"===l){if(this.callback(Sk.Tokenizer.Tokens.T_COMMENT,e,k,b,a))return"done"}else if(triple_quoted.hasOwnProperty(e))if(this.endprog=h[e],this.endprog.lastIndex=0,b=this.endprog.test(a.substring(c))){if(c=this.endprog.lastIndex+c,e=a.substring(d,c),this.callback(Sk.Tokenizer.Tokens.T_STRING,e,k,[this.lnum,c],a))return"done"}else{this.strstart=[this.lnum,d];this.contstr=a.substring(d);this.contline=a;break}else if(single_quoted.hasOwnProperty(l)||single_quoted.hasOwnProperty(e.substring(0,
2))||single_quoted.hasOwnProperty(e.substring(0,3)))if("\n"===e[e.length-1]){this.strstart=[this.lnum,d];this.endprog=h[l]||h[e[1]]||h[e[2]];this.contstr=a.substring(d);this.needcont=!0;this.contline=a;break}else{if(this.callback(Sk.Tokenizer.Tokens.T_STRING,e,k,b,a))return"done"}else if(-1!==this.namechars.indexOf(l)){if(this.callback(Sk.Tokenizer.Tokens.T_NAME,e,k,b,a))return"done"}else if("\\"===l){if(this.callback(Sk.Tokenizer.Tokens.T_NL,e,k,[this.lnum,c],a))return"done";this.continued=!0}else if(-1!==
"([{".indexOf(l)?this.parenlev+=1:-1!==")]}".indexOf(l)&&(this.parenlev-=1),this.callback(Sk.Tokenizer.Tokens.T_OP,e,k,b,a))return"done"}else{if(this.callback(Sk.Tokenizer.Tokens.T_ERRORTOKEN,a.charAt(c),[this.lnum,c],[this.lnum,c+1],a))return"done";c+=1}}return!1};
Sk.Tokenizer.tokenNames={0:"T_ENDMARKER",1:"T_NAME",2:"T_NUMBER",3:"T_STRING",4:"T_NEWLINE",5:"T_INDENT",6:"T_DEDENT",7:"T_LPAR",8:"T_RPAR",9:"T_LSQB",10:"T_RSQB",11:"T_COLON",12:"T_COMMA",13:"T_SEMI",14:"T_PLUS",15:"T_MINUS",16:"T_STAR",17:"T_SLASH",18:"T_VBAR",19:"T_AMPER",20:"T_LESS",21:"T_GREATER",22:"T_EQUAL",23:"T_DOT",24:"T_PERCENT",25:"T_BACKQUOTE",26:"T_LBRACE",27:"T_RBRACE",28:"T_EQEQUAL",29:"T_NOTEQUAL",30:"T_LESSEQUAL",31:"T_GREATEREQUAL",32:"T_TILDE",33:"T_CIRCUMFLEX",34:"T_LEFTSHIFT",
35:"T_RIGHTSHIFT",36:"T_DOUBLESTAR",37:"T_PLUSEQUAL",38:"T_MINEQUAL",39:"T_STAREQUAL",40:"T_SLASHEQUAL",41:"T_PERCENTEQUAL",42:"T_AMPEREQUAL",43:"T_VBAREQUAL",44:"T_CIRCUMFLEXEQUAL",45:"T_LEFTSHIFTEQUAL",46:"T_RIGHTSHIFTEQUAL",47:"T_DOUBLESTAREQUAL",48:"T_DOUBLESLASH",49:"T_DOUBLESLASHEQUAL",50:"T_AT",51:"T_OP",52:"T_COMMENT",53:"T_NL",54:"T_RARROW",55:"T_ERRORTOKEN",56:"T_N_TOKENS",256:"T_NT_OFFSET"};goog.exportSymbol("Sk.Tokenizer",Sk.Tokenizer);
goog.exportSymbol("Sk.Tokenizer.prototype.generateTokens",Sk.Tokenizer.prototype.generateTokens);goog.exportSymbol("Sk.Tokenizer.tokenNames",Sk.Tokenizer.tokenNames);Sk.OpMap={"(":Sk.Tokenizer.Tokens.T_LPAR,")":Sk.Tokenizer.Tokens.T_RPAR,"[":Sk.Tokenizer.Tokens.T_LSQB,"]":Sk.Tokenizer.Tokens.T_RSQB,":":Sk.Tokenizer.Tokens.T_COLON,",":Sk.Tokenizer.Tokens.T_COMMA,";":Sk.Tokenizer.Tokens.T_SEMI,"+":Sk.Tokenizer.Tokens.T_PLUS,"-":Sk.Tokenizer.Tokens.T_MINUS,"*":Sk.Tokenizer.Tokens.T_STAR,"/":Sk.Tokenizer.Tokens.T_SLASH,"|":Sk.Tokenizer.Tokens.T_VBAR,"&":Sk.Tokenizer.Tokens.T_AMPER,"<":Sk.Tokenizer.Tokens.T_LESS,">":Sk.Tokenizer.Tokens.T_GREATER,"=":Sk.Tokenizer.Tokens.T_EQUAL,
".":Sk.Tokenizer.Tokens.T_DOT,"%":Sk.Tokenizer.Tokens.T_PERCENT,"`":Sk.Tokenizer.Tokens.T_BACKQUOTE,"{":Sk.Tokenizer.Tokens.T_LBRACE,"}":Sk.Tokenizer.Tokens.T_RBRACE,"@":Sk.Tokenizer.Tokens.T_AT,"==":Sk.Tokenizer.Tokens.T_EQEQUAL,"!=":Sk.Tokenizer.Tokens.T_NOTEQUAL,"<>":Sk.Tokenizer.Tokens.T_NOTEQUAL,"<=":Sk.Tokenizer.Tokens.T_LESSEQUAL,">=":Sk.Tokenizer.Tokens.T_GREATEREQUAL,"~":Sk.Tokenizer.Tokens.T_TILDE,"^":Sk.Tokenizer.Tokens.T_CIRCUMFLEX,"<<":Sk.Tokenizer.Tokens.T_LEFTSHIFT,">>":Sk.Tokenizer.Tokens.T_RIGHTSHIFT,
"**":Sk.Tokenizer.Tokens.T_DOUBLESTAR,"+=":Sk.Tokenizer.Tokens.T_PLUSEQUAL,"-=":Sk.Tokenizer.Tokens.T_MINEQUAL,"*=":Sk.Tokenizer.Tokens.T_STAREQUAL,"/=":Sk.Tokenizer.Tokens.T_SLASHEQUAL,"%=":Sk.Tokenizer.Tokens.T_PERCENTEQUAL,"&=":Sk.Tokenizer.Tokens.T_AMPEREQUAL,"|=":Sk.Tokenizer.Tokens.T_VBAREQUAL,"^=":Sk.Tokenizer.Tokens.T_CIRCUMFLEXEQUAL,"<<=":Sk.Tokenizer.Tokens.T_LEFTSHIFTEQUAL,">>=":Sk.Tokenizer.Tokens.T_RIGHTSHIFTEQUAL,"**=":Sk.Tokenizer.Tokens.T_DOUBLESTAREQUAL,"//":Sk.Tokenizer.Tokens.T_DOUBLESLASH,
"//=":Sk.Tokenizer.Tokens.T_DOUBLESLASHEQUAL,"->":Sk.Tokenizer.Tokens.T_RARROW};
Sk.ParseTables={sym:{and_expr:257,and_test:258,arglist:259,argument:260,arith_expr:261,assert_stmt:262,atom:263,augassign:264,break_stmt:265,classdef:266,comp_op:267,comparison:268,compound_stmt:269,continue_stmt:270,decorated:271,decorator:272,decorators:273,del_stmt:274,dictmaker:275,dotted_as_name:276,dotted_as_names:277,dotted_name:278,encoding_decl:279,eval_input:280,except_clause:281,exec_stmt:282,expr:283,expr_stmt:284,exprlist:285,factor:286,file_input:287,flow_stmt:288,for_stmt:289,fpdef:290,
fplist:291,funcdef:292,gen_for:293,gen_if:294,gen_iter:295,global_stmt:296,if_stmt:297,import_as_name:298,import_as_names:299,import_from:300,import_name:301,import_stmt:302,lambdef:303,list_for:304,list_if:305,list_iter:306,listmaker:307,not_test:308,old_lambdef:309,old_test:310,or_test:311,parameters:312,pass_stmt:313,power:314,print_stmt:315,raise_stmt:316,return_stmt:317,shift_expr:318,simple_stmt:319,single_input:256,sliceop:320,small_stmt:321,stmt:322,subscript:323,subscriptlist:324,suite:325,
term:326,test:327,testlist:328,testlist1:329,testlist_gexp:330,testlist_safe:331,trailer:332,try_stmt:333,varargslist:334,while_stmt:335,with_stmt:336,with_var:337,xor_expr:338,yield_expr:339,yield_stmt:340},number2symbol:{256:"single_input",257:"and_expr",258:"and_test",259:"arglist",260:"argument",261:"arith_expr",262:"assert_stmt",263:"atom",264:"augassign",265:"break_stmt",266:"classdef",267:"comp_op",268:"comparison",269:"compound_stmt",270:"continue_stmt",271:"decorated",272:"decorator",273:"decorators",
274:"del_stmt",275:"dictmaker",276:"dotted_as_name",277:"dotted_as_names",278:"dotted_name",279:"encoding_decl",280:"eval_input",281:"except_clause",282:"exec_stmt",283:"expr",284:"expr_stmt",285:"exprlist",286:"factor",287:"file_input",288:"flow_stmt",289:"for_stmt",290:"fpdef",291:"fplist",292:"funcdef",293:"gen_for",294:"gen_if",295:"gen_iter",296:"global_stmt",297:"if_stmt",298:"import_as_name",299:"import_as_names",300:"import_from",301:"import_name",302:"import_stmt",303:"lambdef",304:"list_for",
305:"list_if",306:"list_iter",307:"listmaker",308:"not_test",309:"old_lambdef",310:"old_test",311:"or_test",312:"parameters",313:"pass_stmt",314:"power",315:"print_stmt",316:"raise_stmt",317:"return_stmt",318:"shift_expr",319:"simple_stmt",320:"sliceop",321:"small_stmt",322:"stmt",323:"subscript",324:"subscriptlist",325:"suite",326:"term",327:"test",328:"testlist",329:"testlist1",330:"testlist_gexp",331:"testlist_safe",332:"trailer",333:"try_stmt",334:"varargslist",335:"while_stmt",336:"with_stmt",
337:"with_var",338:"xor_expr",339:"yield_expr",340:"yield_stmt"},dfas:{256:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1}],257:[[[[37,1]],[[38,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],258:[[[[39,1]],[[40,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],259:[[[[41,1],[42,2],[43,3]],[[44,4]],[[45,5],[0,2]],[[44,
6]],[[45,7],[0,4]],[[41,1],[42,2],[43,3],[0,5]],[[0,6]],[[42,4],[43,3]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1,41:1,43:1}],260:[[[[44,1]],[[46,2],[47,3],[0,1]],[[0,2]],[[44,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],261:[[[[48,1]],[[24,0],[35,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],262:[[[[19,1]],[[44,2]],[[45,3],[0,2]],[[44,4]],[[0,4]]],{19:1}],263:[[[[17,1],[8,2],[9,5],[28,4],[11,3],[13,6],[20,2]],[[17,1],[0,1]],[[0,2]],[[49,7],[50,2]],
[[51,2],[52,8],[53,8]],[[54,9],[55,2]],[[56,10]],[[50,2]],[[51,2]],[[55,2]],[[13,2]]],{8:1,9:1,11:1,13:1,17:1,20:1,28:1}],264:[[[[57,1],[58,1],[59,1],[60,1],[61,1],[62,1],[63,1],[64,1],[65,1],[66,1],[67,1],[68,1]],[[0,1]]],{57:1,58:1,59:1,60:1,61:1,62:1,63:1,64:1,65:1,66:1,67:1,68:1}],265:[[[[31,1]],[[0,1]]],{31:1}],266:[[[[10,1]],[[20,2]],[[69,3],[28,4]],[[70,5]],[[51,6],[71,7]],[[0,5]],[[69,3]],[[51,6]]],{10:1}],267:[[[[72,1],[73,1],[7,2],[74,1],[72,1],[75,1],[76,1],[77,3],[78,1],[79,1]],[[0,1]],
[[75,1]],[[7,1],[0,3]]],{7:1,72:1,73:1,74:1,75:1,76:1,77:1,78:1,79:1}],268:[[[[80,1]],[[81,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],269:[[[[82,1],[83,1],[84,1],[85,1],[86,1],[87,1],[88,1],[89,1]],[[0,1]]],{4:1,10:1,14:1,16:1,27:1,30:1,33:1,34:1}],270:[[[[32,1]],[[0,1]]],{32:1}],271:[[[[90,1]],[[88,2],[85,2]],[[0,2]]],{33:1}],272:[[[[33,1]],[[91,2]],[[28,4],[2,3]],[[0,3]],[[51,5],[92,6]],[[2,3]],[[51,5]]],{33:1}],273:[[[[93,1]],[[93,1],[0,1]]],{33:1}],274:[[[[21,1]],[[94,2]],[[0,
2]]],{21:1}],275:[[[[44,1]],[[69,2]],[[44,3]],[[45,4],[0,3]],[[44,1],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],276:[[[[91,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],{20:1}],277:[[[[96,1]],[[45,0],[0,1]]],{20:1}],278:[[[[20,1]],[[97,0],[0,1]]],{20:1}],279:[[[[20,1]],[[0,1]]],{20:1}],280:[[[[71,1]],[[2,1],[98,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],281:[[[[99,1]],[[44,2],[0,1]],[[95,3],[45,3],[0,2]],[[44,4]],[[0,4]]],{99:1}],282:[[[[15,1]],[[80,2]],
[[75,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],{15:1}],283:[[[[100,1]],[[101,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],284:[[[[71,1]],[[102,2],[47,3],[0,1]],[[71,4],[53,4]],[[71,5],[53,5]],[[0,4]],[[47,3],[0,5]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],285:[[[[80,1]],[[45,2],[0,1]],[[80,1],[0,2]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],286:[[[[103,2],[24,1],[6,1],[35,1]],[[104,2]],[[0,2]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],
287:[[[[2,0],[98,1],[105,0]],[[0,1]]],{2:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,98:1}],288:[[[[106,1],[107,1],[108,1],[109,1],[110,1]],[[0,1]]],{5:1,18:1,25:1,31:1,32:1}],289:[[[[27,1]],[[94,2]],[[75,3]],[[71,4]],[[69,5]],[[70,6]],[[111,7],[0,6]],[[69,8]],[[70,9]],[[0,9]]],{27:1}],290:[[[[28,1],[20,2]],[[112,3]],[[0,2]],[[51,2]]],{20:1,28:1}],291:[[[[113,1]],[[45,2],[0,1]],[[113,
1],[0,2]]],{20:1,28:1}],292:[[[[4,1]],[[20,2]],[[114,3]],[[69,4]],[[70,5]],[[0,5]]],{4:1}],293:[[[[27,1]],[[94,2]],[[75,3]],[[115,4]],[[116,5],[0,4]],[[0,5]]],{27:1}],294:[[[[30,1]],[[117,2]],[[116,3],[0,2]],[[0,3]]],{30:1}],295:[[[[46,1],[118,1]],[[0,1]]],{27:1,30:1}],296:[[[[26,1]],[[20,2]],[[45,1],[0,2]]],{26:1}],297:[[[[30,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[119,1],[0,4]],[[69,6]],[[70,7]],[[0,7]]],{30:1}],298:[[[[20,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],{20:1}],299:[[[[120,1]],[[45,2],[0,
1]],[[120,1],[0,2]]],{20:1}],300:[[[[29,1]],[[91,2],[97,3]],[[23,4]],[[91,2],[23,4],[97,3]],[[121,5],[41,5],[28,6]],[[0,5]],[[121,7]],[[51,5]]],{29:1}],301:[[[[23,1]],[[122,2]],[[0,2]]],{23:1}],302:[[[[123,1],[124,1]],[[0,1]]],{23:1,29:1}],303:[[[[36,1]],[[69,2],[125,3]],[[44,4]],[[69,2]],[[0,4]]],{36:1}],304:[[[[27,1]],[[94,2]],[[75,3]],[[126,4]],[[127,5],[0,4]],[[0,5]]],{27:1}],305:[[[[30,1]],[[117,2]],[[127,3],[0,2]],[[0,3]]],{30:1}],306:[[[[128,1],[129,1]],[[0,1]]],{27:1,30:1}],307:[[[[44,1]],
[[128,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],308:[[[[7,1],[130,2]],[[39,2]],[[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],309:[[[[36,1]],[[69,2],[125,3]],[[117,4]],[[69,2]],[[0,4]]],{36:1}],310:[[[[131,1],[115,1]],[[0,1]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],311:[[[[132,1]],[[133,0],[0,1]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],312:[[[[28,1]],[[51,2],[125,3]],[[0,2]],
[[51,2]]],{28:1}],313:[[[[22,1]],[[0,1]]],{22:1}],314:[[[[134,1]],[[135,1],[43,2],[0,1]],[[104,3]],[[0,3]]],{8:1,9:1,11:1,13:1,17:1,20:1,28:1}],315:[[[[12,1]],[[44,2],[136,3],[0,1]],[[45,4],[0,2]],[[44,5]],[[44,2],[0,4]],[[45,6],[0,5]],[[44,7]],[[45,8],[0,7]],[[44,7],[0,8]]],{12:1}],316:[[[[5,1]],[[44,2],[0,1]],[[45,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],{5:1}],317:[[[[18,1]],[[71,2],[0,1]],[[0,2]]],{18:1}],318:[[[[137,1]],[[136,0],[138,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,
28:1,35:1}],319:[[[[139,1]],[[2,2],[140,3]],[[0,2]],[[139,1],[2,2]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,15:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,28:1,29:1,31:1,32:1,35:1,36:1}],320:[[[[69,1]],[[44,2],[0,1]],[[0,2]]],{69:1}],321:[[[[141,1],[142,1],[143,1],[144,1],[145,1],[146,1],[147,1],[148,1],[149,1]],[[0,1]]],{5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,15:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,28:1,29:1,31:1,32:1,35:1,36:1}],322:[[[[1,1],[3,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,
9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1}],323:[[[[44,1],[69,2],[97,3]],[[69,2],[0,1]],[[44,4],[150,5],[0,2]],[[97,6]],[[150,5],[0,4]],[[0,5]],[[97,5]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1,69:1,97:1}],324:[[[[151,1]],[[45,2],[0,1]],[[151,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1,69:1,97:1}],325:[[[[1,1],[2,2]],[[0,1]],[[152,3]],[[105,4]],[[153,1],[105,4]]],
{2:1,5:1,6:1,7:1,8:1,9:1,11:1,12:1,13:1,15:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,28:1,29:1,31:1,32:1,35:1,36:1}],326:[[[[104,1]],[[154,0],[41,0],[155,0],[156,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],327:[[[[115,1],[157,2]],[[30,3],[0,1]],[[0,2]],[[115,4]],[[111,5]],[[44,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],328:[[[[44,1]],[[45,2],[0,1]],[[44,1],[0,2]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],329:[[[[44,1]],[[45,0],[0,1]]],
{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],330:[[[[44,1]],[[46,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],331:[[[[117,1]],[[45,2],[0,1]],[[117,3]],[[45,4],[0,3]],[[117,3],[0,4]]],{6:1,7:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1,36:1}],332:[[[[28,1],[97,2],[11,3]],[[51,4],[92,5]],[[20,4]],[[158,6]],[[0,4]],[[51,4]],[[50,4]]],{11:1,28:1,97:1}],333:[[[[14,1]],[[69,2]],[[70,3]],[[159,4],[160,5]],[[69,6]],[[69,7]],
[[70,8]],[[70,9]],[[159,4],[111,10],[160,5],[0,8]],[[0,9]],[[69,11]],[[70,12]],[[160,5],[0,12]]],{14:1}],334:[[[[41,1],[113,2],[43,3]],[[20,4]],[[47,5],[45,6],[0,2]],[[20,7]],[[45,8],[0,4]],[[44,9]],[[41,1],[113,2],[43,3],[0,6]],[[0,7]],[[43,3]],[[45,6],[0,9]]],{20:1,28:1,41:1,43:1}],335:[[[[16,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[0,4]],[[69,6]],[[70,7]],[[0,7]]],{16:1}],336:[[[[34,1]],[[44,2]],[[69,3],[161,4]],[[70,5]],[[69,3]],[[0,5]]],{34:1}],337:[[[[95,1]],[[80,2]],[[0,2]]],{95:1}],338:[[[[162,
1]],[[163,0],[0,1]]],{6:1,8:1,9:1,11:1,13:1,17:1,20:1,24:1,28:1,35:1}],339:[[[[25,1]],[[71,2],[0,1]],[[0,2]]],{25:1}],340:[[[[53,1]],[[0,1]]],{25:1}]},states:[[[[1,1],[2,1],[3,2]],[[0,1]],[[2,1]]],[[[37,1]],[[38,0],[0,1]]],[[[39,1]],[[40,0],[0,1]]],[[[41,1],[42,2],[43,3]],[[44,4]],[[45,5],[0,2]],[[44,6]],[[45,7],[0,4]],[[41,1],[42,2],[43,3],[0,5]],[[0,6]],[[42,4],[43,3]]],[[[44,1]],[[46,2],[47,3],[0,1]],[[0,2]],[[44,2]]],[[[48,1]],[[24,0],[35,0],[0,1]]],[[[19,1]],[[44,2]],[[45,3],[0,2]],[[44,4]],
[[0,4]]],[[[17,1],[8,2],[9,5],[28,4],[11,3],[13,6],[20,2]],[[17,1],[0,1]],[[0,2]],[[49,7],[50,2]],[[51,2],[52,8],[53,8]],[[54,9],[55,2]],[[56,10]],[[50,2]],[[51,2]],[[55,2]],[[13,2]]],[[[57,1],[58,1],[59,1],[60,1],[61,1],[62,1],[63,1],[64,1],[65,1],[66,1],[67,1],[68,1]],[[0,1]]],[[[31,1]],[[0,1]]],[[[10,1]],[[20,2]],[[69,3],[28,4]],[[70,5]],[[51,6],[71,7]],[[0,5]],[[69,3]],[[51,6]]],[[[72,1],[73,1],[7,2],[74,1],[72,1],[75,1],[76,1],[77,3],[78,1],[79,1]],[[0,1]],[[75,1]],[[7,1],[0,3]]],[[[80,1]],[[81,
0],[0,1]]],[[[82,1],[83,1],[84,1],[85,1],[86,1],[87,1],[88,1],[89,1]],[[0,1]]],[[[32,1]],[[0,1]]],[[[90,1]],[[88,2],[85,2]],[[0,2]]],[[[33,1]],[[91,2]],[[28,4],[2,3]],[[0,3]],[[51,5],[92,6]],[[2,3]],[[51,5]]],[[[93,1]],[[93,1],[0,1]]],[[[21,1]],[[94,2]],[[0,2]]],[[[44,1]],[[69,2]],[[44,3]],[[45,4],[0,3]],[[44,1],[0,4]]],[[[91,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],[[[96,1]],[[45,0],[0,1]]],[[[20,1]],[[97,0],[0,1]]],[[[20,1]],[[0,1]]],[[[71,1]],[[2,1],[98,2]],[[0,2]]],[[[99,1]],[[44,2],[0,1]],[[95,3],
[45,3],[0,2]],[[44,4]],[[0,4]]],[[[15,1]],[[80,2]],[[75,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],[[[100,1]],[[101,0],[0,1]]],[[[71,1]],[[102,2],[47,3],[0,1]],[[71,4],[53,4]],[[71,5],[53,5]],[[0,4]],[[47,3],[0,5]]],[[[80,1]],[[45,2],[0,1]],[[80,1],[0,2]]],[[[103,2],[24,1],[6,1],[35,1]],[[104,2]],[[0,2]]],[[[2,0],[98,1],[105,0]],[[0,1]]],[[[106,1],[107,1],[108,1],[109,1],[110,1]],[[0,1]]],[[[27,1]],[[94,2]],[[75,3]],[[71,4]],[[69,5]],[[70,6]],[[111,7],[0,6]],[[69,8]],[[70,9]],[[0,9]]],[[[28,
1],[20,2]],[[112,3]],[[0,2]],[[51,2]]],[[[113,1]],[[45,2],[0,1]],[[113,1],[0,2]]],[[[4,1]],[[20,2]],[[114,3]],[[69,4]],[[70,5]],[[0,5]]],[[[27,1]],[[94,2]],[[75,3]],[[115,4]],[[116,5],[0,4]],[[0,5]]],[[[30,1]],[[117,2]],[[116,3],[0,2]],[[0,3]]],[[[46,1],[118,1]],[[0,1]]],[[[26,1]],[[20,2]],[[45,1],[0,2]]],[[[30,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[119,1],[0,4]],[[69,6]],[[70,7]],[[0,7]]],[[[20,1]],[[95,2],[0,1]],[[20,3]],[[0,3]]],[[[120,1]],[[45,2],[0,1]],[[120,1],[0,2]]],[[[29,1]],[[91,2],[97,
3]],[[23,4]],[[91,2],[23,4],[97,3]],[[121,5],[41,5],[28,6]],[[0,5]],[[121,7]],[[51,5]]],[[[23,1]],[[122,2]],[[0,2]]],[[[123,1],[124,1]],[[0,1]]],[[[36,1]],[[69,2],[125,3]],[[44,4]],[[69,2]],[[0,4]]],[[[27,1]],[[94,2]],[[75,3]],[[126,4]],[[127,5],[0,4]],[[0,5]]],[[[30,1]],[[117,2]],[[127,3],[0,2]],[[0,3]]],[[[128,1],[129,1]],[[0,1]]],[[[44,1]],[[128,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],[[[7,1],[130,2]],[[39,2]],[[0,2]]],[[[36,1]],[[69,2],[125,3]],[[117,4]],[[69,2]],[[0,4]]],[[[131,
1],[115,1]],[[0,1]]],[[[132,1]],[[133,0],[0,1]]],[[[28,1]],[[51,2],[125,3]],[[0,2]],[[51,2]]],[[[22,1]],[[0,1]]],[[[134,1]],[[135,1],[43,2],[0,1]],[[104,3]],[[0,3]]],[[[12,1]],[[44,2],[136,3],[0,1]],[[45,4],[0,2]],[[44,5]],[[44,2],[0,4]],[[45,6],[0,5]],[[44,7]],[[45,8],[0,7]],[[44,7],[0,8]]],[[[5,1]],[[44,2],[0,1]],[[45,3],[0,2]],[[44,4]],[[45,5],[0,4]],[[44,6]],[[0,6]]],[[[18,1]],[[71,2],[0,1]],[[0,2]]],[[[137,1]],[[136,0],[138,0],[0,1]]],[[[139,1]],[[2,2],[140,3]],[[0,2]],[[139,1],[2,2]]],[[[69,
1]],[[44,2],[0,1]],[[0,2]]],[[[141,1],[142,1],[143,1],[144,1],[145,1],[146,1],[147,1],[148,1],[149,1]],[[0,1]]],[[[1,1],[3,1]],[[0,1]]],[[[44,1],[69,2],[97,3]],[[69,2],[0,1]],[[44,4],[150,5],[0,2]],[[97,6]],[[150,5],[0,4]],[[0,5]],[[97,5]]],[[[151,1]],[[45,2],[0,1]],[[151,1],[0,2]]],[[[1,1],[2,2]],[[0,1]],[[152,3]],[[105,4]],[[153,1],[105,4]]],[[[104,1]],[[154,0],[41,0],[155,0],[156,0],[0,1]]],[[[115,1],[157,2]],[[30,3],[0,1]],[[0,2]],[[115,4]],[[111,5]],[[44,2]]],[[[44,1]],[[45,2],[0,1]],[[44,1],
[0,2]]],[[[44,1]],[[45,0],[0,1]]],[[[44,1]],[[46,2],[45,3],[0,1]],[[0,2]],[[44,4],[0,3]],[[45,3],[0,4]]],[[[117,1]],[[45,2],[0,1]],[[117,3]],[[45,4],[0,3]],[[117,3],[0,4]]],[[[28,1],[97,2],[11,3]],[[51,4],[92,5]],[[20,4]],[[158,6]],[[0,4]],[[51,4]],[[50,4]]],[[[14,1]],[[69,2]],[[70,3]],[[159,4],[160,5]],[[69,6]],[[69,7]],[[70,8]],[[70,9]],[[159,4],[111,10],[160,5],[0,8]],[[0,9]],[[69,11]],[[70,12]],[[160,5],[0,12]]],[[[41,1],[113,2],[43,3]],[[20,4]],[[47,5],[45,6],[0,2]],[[20,7]],[[45,8],[0,4]],[[44,
9]],[[41,1],[113,2],[43,3],[0,6]],[[0,7]],[[43,3]],[[45,6],[0,9]]],[[[16,1]],[[44,2]],[[69,3]],[[70,4]],[[111,5],[0,4]],[[69,6]],[[70,7]],[[0,7]]],[[[34,1]],[[44,2]],[[69,3],[161,4]],[[70,5]],[[69,3]],[[0,5]]],[[[95,1]],[[80,2]],[[0,2]]],[[[162,1]],[[163,0],[0,1]]],[[[25,1]],[[71,2],[0,1]],[[0,2]]],[[[53,1]],[[0,1]]]],labels:[[0,"EMPTY"],[319,null],[4,null],[269,null],[1,"def"],[1,"raise"],[32,null],[1,"not"],[2,null],[26,null],[1,"class"],[9,null],[1,"print"],[25,null],[1,"try"],[1,"exec"],[1,"while"],
[3,null],[1,"return"],[1,"assert"],[1,null],[1,"del"],[1,"pass"],[1,"import"],[15,null],[1,"yield"],[1,"global"],[1,"for"],[7,null],[1,"from"],[1,"if"],[1,"break"],[1,"continue"],[50,null],[1,"with"],[14,null],[1,"lambda"],[318,null],[19,null],[308,null],[1,"and"],[16,null],[260,null],[36,null],[327,null],[12,null],[293,null],[22,null],[326,null],[307,null],[10,null],[8,null],[330,null],[339,null],[275,null],[27,null],[329,null],[46,null],[39,null],[41,null],[47,null],[42,null],[43,null],[37,null],
[44,null],[49,null],[40,null],[38,null],[45,null],[11,null],[325,null],[328,null],[29,null],[21,null],[28,null],[1,"in"],[30,null],[1,"is"],[31,null],[20,null],[283,null],[267,null],[333,null],[297,null],[289,null],[266,null],[336,null],[335,null],[292,null],[271,null],[273,null],[278,null],[259,null],[272,null],[285,null],[1,"as"],[276,null],[23,null],[0,null],[1,"except"],[338,null],[18,null],[264,null],[314,null],[286,null],[322,null],[265,null],[270,null],[316,null],[317,null],[340,null],[1,"else"],
[291,null],[290,null],[312,null],[311,null],[295,null],[310,null],[294,null],[1,"elif"],[298,null],[299,null],[277,null],[301,null],[300,null],[334,null],[331,null],[306,null],[304,null],[305,null],[268,null],[309,null],[258,null],[1,"or"],[263,null],[332,null],[35,null],[261,null],[34,null],[321,null],[13,null],[288,null],[262,null],[284,null],[313,null],[315,null],[274,null],[282,null],[296,null],[302,null],[320,null],[323,null],[5,null],[6,null],[48,null],[17,null],[24,null],[303,null],[324,null],
[281,null],[1,"finally"],[337,null],[257,null],[33,null]],keywords:{and:40,as:95,assert:19,"break":31,"class":10,"continue":32,def:4,del:21,elif:119,"else":111,except:99,exec:15,"finally":160,"for":27,from:29,global:26,"if":30,"import":23,"in":75,is:77,lambda:36,not:7,or:133,pass:22,print:12,raise:5,"return":18,"try":14,"while":16,"with":34,yield:25},tokens:{0:98,1:20,2:8,3:17,4:2,5:152,6:153,7:28,8:51,9:11,10:50,11:69,12:45,13:140,14:35,15:24,16:41,17:155,18:101,19:38,20:79,21:73,22:47,23:97,24:156,
25:13,26:9,27:55,28:74,29:72,30:76,31:78,32:6,33:163,34:138,35:136,36:43,37:63,38:67,39:58,40:66,41:59,42:61,43:62,44:64,45:68,46:57,47:60,48:154,49:65,50:33},start:256};function Parser(a,b){this.filename=a;this.grammar=b;return this}Parser.prototype.setup=function(a){a=a||this.grammar.start;this.stack=[{dfa:this.grammar.dfas[a],state:0,node:{type:a,value:null,context:null,children:[]}}];this.used_names={}};function findInDfa(a,b){for(var c=a.length;c--;)if(a[c][0]===b[0]&&a[c][1]===b[1])return!0;return!1}
Parser.prototype.addtoken=function(a,b,c){var d=this.classify(a,b,c);a:for(;;){for(var e=this.stack[this.stack.length-1],f=e.dfa[0],g=f[e.state],h=0;h<g.length;++h){var k=g[h][0],l=g[h][1],m=this.grammar.labels[k][0];if(d===k){goog.asserts.assert(256>m);this.shift(a,b,l,c);for(a=l;1===f[a].length&&0===f[a][0][0]&&f[a][0][1]===a;){this.pop();if(0===this.stack.length)return!0;e=this.stack[this.stack.length-1];a=e.state;f=e.dfa[0]}return!1}if(256<=m&&this.grammar.dfas[m][1].hasOwnProperty(d)){this.push(m,
this.grammar.dfas[m],l,c);continue a}}if(findInDfa(g,[0,e.state])){if(this.pop(),0===this.stack.length)throw new Sk.builtin.ParseError("too much input",this.filename);}else throw new Sk.builtin.ParseError("bad input",this.filename,c[0][0],c);}};
Parser.prototype.classify=function(a,b,c){if(a===Sk.Tokenizer.Tokens.T_NAME&&(this.used_names[b]=!0,b=this.grammar.keywords.hasOwnProperty(b)&&this.grammar.keywords[b]))return b;b=this.grammar.tokens.hasOwnProperty(a)&&this.grammar.tokens[a];if(!b)throw new Sk.builtin.ParseError("bad token",this.filename,c[0][0],c);return b};
Parser.prototype.shift=function(a,b,c,d){var e=this.stack[this.stack.length-1].dfa,f=this.stack[this.stack.length-1].node;f.children.push({type:a,value:b,lineno:d[0][0],col_offset:d[0][1],children:null});this.stack[this.stack.length-1]={dfa:e,state:c,node:f}};
Parser.prototype.push=function(a,b,c,d){a={type:a,value:null,lineno:d[0][0],col_offset:d[0][1],children:[]};this.stack[this.stack.length-1]={dfa:this.stack[this.stack.length-1].dfa,state:c,node:this.stack[this.stack.length-1].node};this.stack.push({dfa:b,state:0,node:a})};Parser.prototype.pop=function(){var a=this.stack.pop().node;a&&(0!==this.stack.length?this.stack[this.stack.length-1].node.children.push(a):(this.rootnode=a,this.rootnode.used_names=this.used_names))};
function makeParser(a,b){void 0===b&&(b="file_input");var c=new Parser(a,Sk.ParseTables);"file_input"===b?c.setup(Sk.ParseTables.sym.file_input):goog.asserts.fail("todo;");var d=Sk.Tokenizer.Tokens.T_COMMENT,e=Sk.Tokenizer.Tokens.T_NL,f=Sk.Tokenizer.Tokens.T_OP,g=new Sk.Tokenizer(a,"single_input"===b,function(a,b,g,m,n){if(a!==d&&a!==e&&(a===f&&(a=Sk.OpMap[b]),c.addtoken(a,b,[g,m,n])))return!0});return function(a){if(a=g.generateTokens(a)){if("done"!==a)throw new Sk.builtin.ParseError("incomplete input",
this.filename);return c.rootnode}return!1}}Sk.parse=function(a,b){var c=makeParser(a);"\n"!==b.substr(b.length-1,1)&&(b+="\n");for(var d=b.split("\n"),e,f=0;f<d.length;++f)e=c(d[f]+(f===d.length-1?"":"\n"));return e};Sk.parseTreeDump=function(a,b){b=b||"";var c;c=""+b;if(256<=a.type){c+=Sk.ParseTables.number2symbol[a.type]+"\n";for(var d=0;d<a.children.length;++d)c+=Sk.parseTreeDump(a.children[d],b+" ")}else c+=Sk.Tokenizer.tokenNames[a.type]+": "+(new Sk.builtin.str(a.value)).$r().v+"\n";return c};
goog.exportSymbol("Sk.parse",Sk.parse);goog.exportSymbol("Sk.parseTreeDump",Sk.parseTreeDump);function Load(){}function Store(){}function Del(){}function AugLoad(){}function AugStore(){}function Param(){}function And(){}function Or(){}function Add(){}function Sub(){}function Mult(){}function Div(){}function Mod(){}function Pow(){}function LShift(){}function RShift(){}function BitOr(){}function BitXor(){}function BitAnd(){}function FloorDiv(){}function Invert(){}function Not(){}function UAdd(){}function USub(){}function Eq(){}function NotEq(){}function Lt(){}function LtE(){}
function Gt(){}function GtE(){}function Is(){}function IsNot(){}function In_(){}function NotIn(){}function Module(a){this.body=a;return this}function Interactive(a){this.body=a;return this}function Expression(a){goog.asserts.assert(null!==a&&void 0!==a);this.body=a;return this}function Suite(a){this.body=a;return this}
function FunctionDef(a,b,c,d,e,f){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.name=a;this.args=b;this.body=c;this.decorator_list=d;this.lineno=e;this.col_offset=f;return this}function ClassDef(a,b,c,d,e,f){goog.asserts.assert(null!==a&&void 0!==a);this.name=a;this.bases=b;this.body=c;this.decorator_list=d;this.lineno=e;this.col_offset=f;return this}function Return_(a,b,c){this.value=a;this.lineno=b;this.col_offset=c;return this}
function Delete_(a,b,c){this.targets=a;this.lineno=b;this.col_offset=c;return this}function Assign(a,b,c,d){goog.asserts.assert(null!==b&&void 0!==b);this.targets=a;this.value=b;this.lineno=c;this.col_offset=d;return this}function AugAssign(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.target=a;this.op=b;this.value=c;this.lineno=d;this.col_offset=e;return this}
function Print(a,b,c,d,e){this.dest=a;this.values=b;this.nl=c;this.lineno=d;this.col_offset=e;return this}function For_(a,b,c,d,e,f){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.target=a;this.iter=b;this.body=c;this.orelse=d;this.lineno=e;this.col_offset=f;return this}function While_(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}
function If_(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}function With_(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.context_expr=a;this.optional_vars=b;this.body=c;this.lineno=d;this.col_offset=e;return this}function Raise(a,b,c,d,e){this.type=a;this.inst=b;this.tback=c;this.lineno=d;this.col_offset=e;return this}
function TryExcept(a,b,c,d,e){this.body=a;this.handlers=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}function TryFinally(a,b,c,d){this.body=a;this.finalbody=b;this.lineno=c;this.col_offset=d;return this}function Assert(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.test=a;this.msg=b;this.lineno=c;this.col_offset=d;return this}function Import_(a,b,c){this.names=a;this.lineno=b;this.col_offset=c;return this}
function ImportFrom(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.module=a;this.names=b;this.level=c;this.lineno=d;this.col_offset=e;return this}function Exec(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.body=a;this.globals=b;this.locals=c;this.lineno=d;this.col_offset=e;return this}function Global(a,b,c){this.names=a;this.lineno=b;this.col_offset=c;return this}
function Expr(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);this.value=a;this.lineno=b;this.col_offset=c;return this}function Pass(a,b){this.lineno=a;this.col_offset=b;return this}function Break_(a,b){this.lineno=a;this.col_offset=b;return this}function Continue_(a,b){this.lineno=a;this.col_offset=b;return this}function BoolOp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.op=a;this.values=b;this.lineno=c;this.col_offset=d;return this}
function BinOp(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.left=a;this.op=b;this.right=c;this.lineno=d;this.col_offset=e;return this}function UnaryOp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.op=a;this.operand=b;this.lineno=c;this.col_offset=d;return this}
function Lambda(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.args=a;this.body=b;this.lineno=c;this.col_offset=d;return this}function IfExp(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.test=a;this.body=b;this.orelse=c;this.lineno=d;this.col_offset=e;return this}
function Dict(a,b,c,d){this.keys=a;this.values=b;this.lineno=c;this.col_offset=d;return this}function ListComp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this}function GeneratorExp(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);this.elt=a;this.generators=b;this.lineno=c;this.col_offset=d;return this}function Yield(a,b,c){this.value=a;this.lineno=b;this.col_offset=c;return this}
function Compare(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);this.left=a;this.ops=b;this.comparators=c;this.lineno=d;this.col_offset=e;return this}function Call(a,b,c,d,e,f,g){goog.asserts.assert(null!==a&&void 0!==a);this.func=a;this.args=b;this.keywords=c;this.starargs=d;this.kwargs=e;this.lineno=f;this.col_offset=g;return this}function Num(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);this.n=a;this.lineno=b;this.col_offset=c;return this}
function Str(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);this.s=a;this.lineno=b;this.col_offset=c;return this}function Attribute(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.value=a;this.attr=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this}
function Subscript(a,b,c,d,e){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);goog.asserts.assert(null!==c&&void 0!==c);this.value=a;this.slice=b;this.ctx=c;this.lineno=d;this.col_offset=e;return this}function Name(a,b,c,d){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.id=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}
function List(a,b,c,d){goog.asserts.assert(null!==b&&void 0!==b);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}function Tuple(a,b,c,d){goog.asserts.assert(null!==b&&void 0!==b);this.elts=a;this.ctx=b;this.lineno=c;this.col_offset=d;return this}function Ellipsis(){return this}function Slice(a,b,c){this.lower=a;this.upper=b;this.step=c;return this}function ExtSlice(a){this.dims=a;return this}function Index(a){goog.asserts.assert(null!==a&&void 0!==a);this.value=a;return this}
function comprehension(a,b,c){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.target=a;this.iter=b;this.ifs=c;return this}function ExceptHandler(a,b,c,d,e){this.type=a;this.name=b;this.body=c;this.lineno=d;this.col_offset=e;return this}function arguments_(a,b,c,d){this.args=a;this.vararg=b;this.kwarg=c;this.defaults=d;return this}
function keyword(a,b){goog.asserts.assert(null!==a&&void 0!==a);goog.asserts.assert(null!==b&&void 0!==b);this.arg=a;this.value=b;return this}function alias(a,b){goog.asserts.assert(null!==a&&void 0!==a);this.name=a;this.asname=b;return this}Module.prototype._astname="Module";Module.prototype._fields=["body",function(a){return a.body}];Interactive.prototype._astname="Interactive";Interactive.prototype._fields=["body",function(a){return a.body}];Expression.prototype._astname="Expression";
Expression.prototype._fields=["body",function(a){return a.body}];Suite.prototype._astname="Suite";Suite.prototype._fields=["body",function(a){return a.body}];FunctionDef.prototype._astname="FunctionDef";FunctionDef.prototype._fields=["name",function(a){return a.name},"args",function(a){return a.args},"body",function(a){return a.body},"decorator_list",function(a){return a.decorator_list}];ClassDef.prototype._astname="ClassDef";
ClassDef.prototype._fields=["name",function(a){return a.name},"bases",function(a){return a.bases},"body",function(a){return a.body},"decorator_list",function(a){return a.decorator_list}];Return_.prototype._astname="Return";Return_.prototype._fields=["value",function(a){return a.value}];Delete_.prototype._astname="Delete";Delete_.prototype._fields=["targets",function(a){return a.targets}];Assign.prototype._astname="Assign";Assign.prototype._fields=["targets",function(a){return a.targets},"value",function(a){return a.value}];
AugAssign.prototype._astname="AugAssign";AugAssign.prototype._fields=["target",function(a){return a.target},"op",function(a){return a.op},"value",function(a){return a.value}];Print.prototype._astname="Print";Print.prototype._fields=["dest",function(a){return a.dest},"values",function(a){return a.values},"nl",function(a){return a.nl}];For_.prototype._astname="For";
For_.prototype._fields=["target",function(a){return a.target},"iter",function(a){return a.iter},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];While_.prototype._astname="While";While_.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];If_.prototype._astname="If";If_.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];
With_.prototype._astname="With";With_.prototype._fields=["context_expr",function(a){return a.context_expr},"optional_vars",function(a){return a.optional_vars},"body",function(a){return a.body}];Raise.prototype._astname="Raise";Raise.prototype._fields=["type",function(a){return a.type},"inst",function(a){return a.inst},"tback",function(a){return a.tback}];TryExcept.prototype._astname="TryExcept";
TryExcept.prototype._fields=["body",function(a){return a.body},"handlers",function(a){return a.handlers},"orelse",function(a){return a.orelse}];TryFinally.prototype._astname="TryFinally";TryFinally.prototype._fields=["body",function(a){return a.body},"finalbody",function(a){return a.finalbody}];Assert.prototype._astname="Assert";Assert.prototype._fields=["test",function(a){return a.test},"msg",function(a){return a.msg}];Import_.prototype._astname="Import";Import_.prototype._fields=["names",function(a){return a.names}];
ImportFrom.prototype._astname="ImportFrom";ImportFrom.prototype._fields=["module",function(a){return a.module},"names",function(a){return a.names},"level",function(a){return a.level}];Exec.prototype._astname="Exec";Exec.prototype._fields=["body",function(a){return a.body},"globals",function(a){return a.globals},"locals",function(a){return a.locals}];Global.prototype._astname="Global";Global.prototype._fields=["names",function(a){return a.names}];Expr.prototype._astname="Expr";
Expr.prototype._fields=["value",function(a){return a.value}];Pass.prototype._astname="Pass";Pass.prototype._fields=[];Break_.prototype._astname="Break";Break_.prototype._fields=[];Continue_.prototype._astname="Continue";Continue_.prototype._fields=[];BoolOp.prototype._astname="BoolOp";BoolOp.prototype._fields=["op",function(a){return a.op},"values",function(a){return a.values}];BinOp.prototype._astname="BinOp";
BinOp.prototype._fields=["left",function(a){return a.left},"op",function(a){return a.op},"right",function(a){return a.right}];UnaryOp.prototype._astname="UnaryOp";UnaryOp.prototype._fields=["op",function(a){return a.op},"operand",function(a){return a.operand}];Lambda.prototype._astname="Lambda";Lambda.prototype._fields=["args",function(a){return a.args},"body",function(a){return a.body}];IfExp.prototype._astname="IfExp";
IfExp.prototype._fields=["test",function(a){return a.test},"body",function(a){return a.body},"orelse",function(a){return a.orelse}];Dict.prototype._astname="Dict";Dict.prototype._fields=["keys",function(a){return a.keys},"values",function(a){return a.values}];ListComp.prototype._astname="ListComp";ListComp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];GeneratorExp.prototype._astname="GeneratorExp";
GeneratorExp.prototype._fields=["elt",function(a){return a.elt},"generators",function(a){return a.generators}];Yield.prototype._astname="Yield";Yield.prototype._fields=["value",function(a){return a.value}];Compare.prototype._astname="Compare";Compare.prototype._fields=["left",function(a){return a.left},"ops",function(a){return a.ops},"comparators",function(a){return a.comparators}];Call.prototype._astname="Call";
Call.prototype._fields=["func",function(a){return a.func},"args",function(a){return a.args},"keywords",function(a){return a.keywords},"starargs",function(a){return a.starargs},"kwargs",function(a){return a.kwargs}];Num.prototype._astname="Num";Num.prototype._fields=["n",function(a){return a.n}];Str.prototype._astname="Str";Str.prototype._fields=["s",function(a){return a.s}];Attribute.prototype._astname="Attribute";
Attribute.prototype._fields=["value",function(a){return a.value},"attr",function(a){return a.attr},"ctx",function(a){return a.ctx}];Subscript.prototype._astname="Subscript";Subscript.prototype._fields=["value",function(a){return a.value},"slice",function(a){return a.slice},"ctx",function(a){return a.ctx}];Name.prototype._astname="Name";Name.prototype._fields=["id",function(a){return a.id},"ctx",function(a){return a.ctx}];List.prototype._astname="List";
List.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];Tuple.prototype._astname="Tuple";Tuple.prototype._fields=["elts",function(a){return a.elts},"ctx",function(a){return a.ctx}];Load.prototype._astname="Load";Load.prototype._isenum=!0;Store.prototype._astname="Store";Store.prototype._isenum=!0;Del.prototype._astname="Del";Del.prototype._isenum=!0;AugLoad.prototype._astname="AugLoad";AugLoad.prototype._isenum=!0;AugStore.prototype._astname="AugStore";
AugStore.prototype._isenum=!0;Param.prototype._astname="Param";Param.prototype._isenum=!0;Ellipsis.prototype._astname="Ellipsis";Ellipsis.prototype._fields=[];Slice.prototype._astname="Slice";Slice.prototype._fields=["lower",function(a){return a.lower},"upper",function(a){return a.upper},"step",function(a){return a.step}];ExtSlice.prototype._astname="ExtSlice";ExtSlice.prototype._fields=["dims",function(a){return a.dims}];Index.prototype._astname="Index";Index.prototype._fields=["value",function(a){return a.value}];
And.prototype._astname="And";And.prototype._isenum=!0;Or.prototype._astname="Or";Or.prototype._isenum=!0;Add.prototype._astname="Add";Add.prototype._isenum=!0;Sub.prototype._astname="Sub";Sub.prototype._isenum=!0;Mult.prototype._astname="Mult";Mult.prototype._isenum=!0;Div.prototype._astname="Div";Div.prototype._isenum=!0;Mod.prototype._astname="Mod";Mod.prototype._isenum=!0;Pow.prototype._astname="Pow";Pow.prototype._isenum=!0;LShift.prototype._astname="LShift";LShift.prototype._isenum=!0;
RShift.prototype._astname="RShift";RShift.prototype._isenum=!0;BitOr.prototype._astname="BitOr";BitOr.prototype._isenum=!0;BitXor.prototype._astname="BitXor";BitXor.prototype._isenum=!0;BitAnd.prototype._astname="BitAnd";BitAnd.prototype._isenum=!0;FloorDiv.prototype._astname="FloorDiv";FloorDiv.prototype._isenum=!0;Invert.prototype._astname="Invert";Invert.prototype._isenum=!0;Not.prototype._astname="Not";Not.prototype._isenum=!0;UAdd.prototype._astname="UAdd";UAdd.prototype._isenum=!0;
USub.prototype._astname="USub";USub.prototype._isenum=!0;Eq.prototype._astname="Eq";Eq.prototype._isenum=!0;NotEq.prototype._astname="NotEq";NotEq.prototype._isenum=!0;Lt.prototype._astname="Lt";Lt.prototype._isenum=!0;LtE.prototype._astname="LtE";LtE.prototype._isenum=!0;Gt.prototype._astname="Gt";Gt.prototype._isenum=!0;GtE.prototype._astname="GtE";GtE.prototype._isenum=!0;Is.prototype._astname="Is";Is.prototype._isenum=!0;IsNot.prototype._astname="IsNot";IsNot.prototype._isenum=!0;
In_.prototype._astname="In";In_.prototype._isenum=!0;NotIn.prototype._astname="NotIn";NotIn.prototype._isenum=!0;comprehension.prototype._astname="comprehension";comprehension.prototype._fields=["target",function(a){return a.target},"iter",function(a){return a.iter},"ifs",function(a){return a.ifs}];ExceptHandler.prototype._astname="ExceptHandler";ExceptHandler.prototype._fields=["type",function(a){return a.type},"name",function(a){return a.name},"body",function(a){return a.body}];
arguments_.prototype._astname="arguments";arguments_.prototype._fields=["args",function(a){return a.args},"vararg",function(a){return a.vararg},"kwarg",function(a){return a.kwarg},"defaults",function(a){return a.defaults}];keyword.prototype._astname="keyword";keyword.prototype._fields=["arg",function(a){return a.arg},"value",function(a){return a.value}];alias.prototype._astname="alias";alias.prototype._fields=["name",function(a){return a.name},"asname",function(a){return a.asname}];var SYM=Sk.ParseTables.sym,TOK=Sk.Tokenizer.Tokens;function Compiling(a,b){this.c_encoding=a;this.c_filename=b}function NCH(a){goog.asserts.assert(void 0!==a);return null===a.children?0:a.children.length}function CHILD(a,b){goog.asserts.assert(void 0!==a);goog.asserts.assert(void 0!==b);return a.children[b]}function REQ(a,b){goog.asserts.assert(a.type===b,"node wasn't expected type")}
function strobj(a){goog.asserts.assert("string"===typeof a,"expecting string, got "+typeof a);return new Sk.builtin.str(a)}
function numStmts(a){switch(a.type){case SYM.single_input:if(CHILD(a,0).type===TOK.T_NEWLINE)break;else return numStmts(CHILD(a,0));case SYM.file_input:for(var b=0,c=0;c<NCH(a);++c){var d=CHILD(a,c);d.type===SYM.stmt&&(b+=numStmts(d))}return b;case SYM.stmt:return numStmts(CHILD(a,0));case SYM.compound_stmt:return 1;case SYM.simple_stmt:return Math.floor(NCH(a)/2);case SYM.suite:if(1===NCH(a))return numStmts(CHILD(a,0));b=0;for(c=2;c<NCH(a)-1;++c)b+=numStmts(CHILD(a,c));return b;default:goog.asserts.fail("Non-statement found")}return 0}
function forbiddenCheck(a,b,c,d){if("None"===c)throw new Sk.builtin.SyntaxError("assignment to None",a.c_filename,d);if("True"===c||"False"===c)throw new Sk.builtin.SyntaxError("assignment to True or False is forbidden",a.c_filename,d);}
function setContext(a,b,c,d){goog.asserts.assert(c!==AugStore&&c!==AugLoad);var e=null,f=null;switch(b.constructor){case Attribute:case Name:c===Store&&forbiddenCheck(a,d,b.attr,d.lineno);b.ctx=c;break;case Subscript:b.ctx=c;break;case List:b.ctx=c;e=b.elts;break;case Tuple:if(0===b.elts.length)throw new Sk.builtin.SyntaxError("can't assign to ()",a.c_filename,d.lineno);b.ctx=c;e=b.elts;break;case Lambda:f="lambda";break;case Call:f="function call";break;case BoolOp:case BinOp:case UnaryOp:f="operator";
break;case GeneratorExp:f="generator expression";break;case Yield:f="yield expression";break;case ListComp:f="list comprehension";break;case Dict:case Num:case Str:f="literal";break;case Compare:f="comparison";break;case IfExp:f="conditional expression";break;default:goog.asserts.fail("unhandled expression in assignment")}if(f)throw new Sk.builtin.SyntaxError("can't "+(c===Store?"assign to":"delete")+" "+f,a.c_filename,d.lineno);if(e)for(b=0;b<e.length;++b)setContext(a,e[b],c,d)}var operatorMap={};
(function(){operatorMap[TOK.T_VBAR]=BitOr;operatorMap[TOK.T_VBAR]=BitOr;operatorMap[TOK.T_CIRCUMFLEX]=BitXor;operatorMap[TOK.T_AMPER]=BitAnd;operatorMap[TOK.T_LEFTSHIFT]=LShift;operatorMap[TOK.T_RIGHTSHIFT]=RShift;operatorMap[TOK.T_PLUS]=Add;operatorMap[TOK.T_MINUS]=Sub;operatorMap[TOK.T_STAR]=Mult;operatorMap[TOK.T_SLASH]=Div;operatorMap[TOK.T_DOUBLESLASH]=FloorDiv;operatorMap[TOK.T_PERCENT]=Mod})();
function getOperator(a){goog.asserts.assert(void 0!==operatorMap[a.type]);return operatorMap[a.type]}
function astForCompOp(a,b){REQ(b,SYM.comp_op);if(1===NCH(b))switch(b=CHILD(b,0),b.type){case TOK.T_LESS:return Lt;case TOK.T_GREATER:return Gt;case TOK.T_EQEQUAL:return Eq;case TOK.T_LESSEQUAL:return LtE;case TOK.T_GREATEREQUAL:return GtE;case TOK.T_NOTEQUAL:return NotEq;case TOK.T_NAME:if("in"===b.value)return In_;if("is"===b.value)return Is}else if(2===NCH(b)&&CHILD(b,0).type===TOK.T_NAME){if("in"===CHILD(b,1).value)return NotIn;if("is"===CHILD(b,0).value)return IsNot}goog.asserts.fail("invalid comp_op")}
function seqForTestlist(a,b){goog.asserts.assert(b.type===SYM.testlist||b.type===SYM.listmaker||b.type===SYM.testlist_gexp||b.type===SYM.testlist_safe||b.type===SYM.testlist1);for(var c=[],d=0;d<NCH(b);d+=2)goog.asserts.assert(CHILD(b,d).type===SYM.test||CHILD(b,d).type===SYM.old_test),c[d/2]=astForExpr(a,CHILD(b,d));return c}
function astForSuite(a,b){REQ(b,SYM.suite);var c=[],d=0,e;if(CHILD(b,0).type===SYM.simple_stmt){b=CHILD(b,0);e=NCH(b)-1;CHILD(b,e-1).type===TOK.T_SEMI&&(e-=1);for(var f=0;f<e;f+=2)c[d++]=astForStmt(a,CHILD(b,f))}else for(f=2;f<NCH(b)-1;++f)if(e=CHILD(b,f),REQ(e,SYM.stmt),1===numStmts(e))c[d++]=astForStmt(a,e);else{e=CHILD(e,0);REQ(e,SYM.simple_stmt);for(var g=0;g<NCH(e);g+=2){if(0===NCH(CHILD(e,g))){goog.asserts.assert(g+1===NCH(e));break}c[d++]=astForStmt(a,CHILD(e,g))}}goog.asserts.assert(d===numStmts(b));
return c}
function astForExceptClause(a,b,c){REQ(b,SYM.except_clause);REQ(c,SYM.suite);if(1===NCH(b))return new ExceptHandler(null,null,astForSuite(a,c),b.lineno,b.col_offset);if(2===NCH(b))return new ExceptHandler(astForExpr(a,CHILD(b,1)),null,astForSuite(a,c),b.lineno,b.col_offset);if(4===NCH(b)){var d=astForExpr(a,CHILD(b,3));setContext(a,d,Store,CHILD(b,3));return new ExceptHandler(astForExpr(a,CHILD(b,1)),d,astForSuite(a,c),b.lineno,b.col_offset)}goog.asserts.fail("wrong number of children for except clause")}
function astForTryStmt(a,b){var c=NCH(b),d=(c-3)/3,e,f=[],g=null;REQ(b,SYM.try_stmt);e=astForSuite(a,CHILD(b,2));if(CHILD(b,c-3).type===TOK.T_NAME)"finally"===CHILD(b,c-3).value?(9<=c&&CHILD(b,c-6).type===TOK.T_NAME&&(f=astForSuite(a,CHILD(b,c-4)),d--),g=astForSuite(a,CHILD(b,c-1))):f=astForSuite(a,CHILD(b,c-1)),d--;else if(CHILD(b,c-3).type!==SYM.except_clause)throw new Sk.builtin.SyntaxError("malformed 'try' statement",a.c_filename,b.lineno);if(0<d){for(var c=[],h=0;h<d;++h)c[h]=astForExceptClause(a,
CHILD(b,3+3*h),CHILD(b,5+3*h));d=new TryExcept(e,c,f,b.lineno,b.col_offset);if(!g)return d;e=[d]}goog.asserts.assert(null!==g);return new TryFinally(e,g,b.lineno,b.col_offset)}function astForDottedName(a,b){REQ(b,SYM.dotted_name);for(var c=b.lineno,d=b.col_offset,e=strobj(CHILD(b,0).value),f=new Name(e,Load,c,d),g=2;g<NCH(b);g+=2)e=strobj(CHILD(b,g).value),f=new Attribute(f,e,Load,c,d);return f}
function astForDecorator(a,b){REQ(b,SYM.decorator);REQ(CHILD(b,0),TOK.T_AT);REQ(CHILD(b,NCH(b)-1),TOK.T_NEWLINE);var c=astForDottedName(a,CHILD(b,1));return 3===NCH(b)?c:5===NCH(b)?new Call(c,[],[],null,null,b.lineno,b.col_offset):astForCall(a,CHILD(b,3),c)}function astForDecorators(a,b){REQ(b,SYM.decorators);for(var c=[],d=0;d<NCH(b);++d)c[d]=astForDecorator(a,CHILD(b,d));return c}
function astForDecorated(a,b){REQ(b,SYM.decorated);var c=astForDecorators(a,CHILD(b,0));goog.asserts.assert(CHILD(b,1).type===SYM.funcdef||CHILD(b,1).type===SYM.classdef);var d=null;CHILD(b,1).type===SYM.funcdef?d=astForFuncdef(a,CHILD(b,1),c):CHILD(b,1)===SYM.classdef&&(d=astForClassdef(a,CHILD(b,1),c));d&&(d.lineno=b.lineno,d.col_offset=b.col_offset);return d}function astForWithVar(a,b){REQ(b,SYM.with_var);return astForExpr(a,CHILD(b,1))}
function astForWithStmt(a,b){var c=3;goog.asserts.assert(b.type===SYM.with_stmt);var d=astForExpr(a,CHILD(b,1));if(CHILD(b,2).type===SYM.with_var){var e=astForWithVar(a,CHILD(b,2));setContext(a,e,Store,b);c=4}return new With_(d,e,astForSuite(a,CHILD(b,c)),b.lineno,b.col_offset)}
function astForExecStmt(a,b){var c,d=null,e=null,f=NCH(b);goog.asserts.assert(2===f||4===f||6===f);REQ(b,SYM.exec_stmt);c=astForExpr(a,CHILD(b,1));4<=f&&(d=astForExpr(a,CHILD(b,3)));6===f&&(e=astForExpr(a,CHILD(b,5)));return new Exec(c,d,e,b.lineno,b.col_offset)}
function astForIfStmt(a,b){REQ(b,SYM.if_stmt);if(4===NCH(b))return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),[],b.lineno,b.col_offset);var c=CHILD(b,4).value.charAt(2);if("s"===c)return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),astForSuite(a,CHILD(b,6)),b.lineno,b.col_offset);if("i"===c){var c=NCH(b)-4,d=!1,e=[];CHILD(b,c+1).type===TOK.T_NAME&&"s"===CHILD(b,c+1).value.charAt(2)&&(d=!0,c-=3);c/=4;d&&(e=[new If_(astForExpr(a,CHILD(b,NCH(b)-6)),astForSuite(a,CHILD(b,
NCH(b)-4)),astForSuite(a,CHILD(b,NCH(b)-1)),CHILD(b,NCH(b)-6).lineno,CHILD(b,NCH(b)-6).col_offset)],c--);for(d=0;d<c;++d)var f=5+4*(c-d-1),e=[new If_(astForExpr(a,CHILD(b,f)),astForSuite(a,CHILD(b,f+2)),e,CHILD(b,f).lineno,CHILD(b,f).col_offset)];return new If_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),e,b.lineno,b.col_offset)}goog.asserts.fail("unexpected token in 'if' statement")}
function astForExprlist(a,b,c){REQ(b,SYM.exprlist);for(var d=[],e=0;e<NCH(b);e+=2){var f=astForExpr(a,CHILD(b,e));d[e/2]=f;c&&setContext(a,f,c,CHILD(b,e))}return d}function astForDelStmt(a,b){REQ(b,SYM.del_stmt);return new Delete_(astForExprlist(a,CHILD(b,1),Del),b.lineno,b.col_offset)}function astForGlobalStmt(a,b){REQ(b,SYM.global_stmt);for(var c=[],d=1;d<NCH(b);d+=2)c[(d-1)/2]=strobj(CHILD(b,d).value);return new Global(c,b.lineno,b.col_offset)}
function astForAssertStmt(a,b){REQ(b,SYM.assert_stmt);if(2===NCH(b))return new Assert(astForExpr(a,CHILD(b,1)),null,b.lineno,b.col_offset);if(4===NCH(b))return new Assert(astForExpr(a,CHILD(b,1)),astForExpr(a,CHILD(b,3)),b.lineno,b.col_offset);goog.asserts.fail("improper number of parts to assert stmt")}
function aliasForImportName(a,b){a:for(;;)switch(b.type){case SYM.import_as_name:var c=null,d=strobj(CHILD(b,0).value);3===NCH(b)&&(c=CHILD(b,2).value);return new alias(d,null==c?null:strobj(c));case SYM.dotted_as_name:if(1===NCH(b)){b=CHILD(b,0);continue a}else return c=aliasForImportName(a,CHILD(b,0)),goog.asserts.assert(!c.asname),c.asname=strobj(CHILD(b,2).value),c;case SYM.dotted_name:if(1===NCH(b))return new alias(strobj(CHILD(b,0).value),null);c="";for(d=0;d<NCH(b);d+=2)c+=CHILD(b,d).value+
".";return new alias(strobj(c.substr(0,c.length-1)),null);case TOK.T_STAR:return new alias(strobj("*"),null);default:throw new Sk.builtin.SyntaxError("unexpected import name",a.c_filename,b.lineno);}}
function astForImportStmt(a,b){REQ(b,SYM.import_stmt);var c=b.lineno,d=b.col_offset;b=CHILD(b,0);if(b.type===SYM.import_name){b=CHILD(b,1);REQ(b,SYM.dotted_as_names);for(var e=[],f=0;f<NCH(b);f+=2)e[f/2]=aliasForImportName(a,CHILD(b,f));return new Import_(e,c,d)}if(b.type===SYM.import_from){for(var g=null,h=0,e=1;e<NCH(b);++e){if(CHILD(b,e).type===SYM.dotted_name){g=aliasForImportName(a,CHILD(b,e));e++;break}else if(CHILD(b,e).type!==TOK.T_DOT)break;h++}++e;switch(CHILD(b,e).type){case TOK.T_STAR:b=
CHILD(b,e);break;case TOK.T_LPAR:b=CHILD(b,e+1);NCH(b);break;case SYM.import_as_names:b=CHILD(b,e);e=NCH(b);if(0===e%2)throw new Sk.builtin.SyntaxError("trailing comma not allowed without surrounding parentheses",a.c_filename,b.lineno);break;default:throw new Sk.builtin.SyntaxError("Unexpected node-type in from-import",a.c_filename,b.lineno);}e=[];if(b.type===TOK.T_STAR)e[0]=aliasForImportName(a,b);else for(f=0;f<NCH(b);f+=2)e[f/2]=aliasForImportName(a,CHILD(b,f));return new ImportFrom(strobj(g?g.name.v:
""),e,h,c,d)}throw new Sk.builtin.SyntaxError("unknown import statement",a.c_filename,b.lineno);}function astForTestlistGexp(a,b){goog.asserts.assert(b.type===SYM.testlist_gexp||b.type===SYM.argument);return 1<NCH(b)&&CHILD(b,1).type===SYM.gen_for?astForGenexp(a,b):astForTestlist(a,b)}
function astForListcomp(a,b){function c(a,b){for(var c=0;;){REQ(b,SYM.list_iter);if(CHILD(b,0).type===SYM.list_for)return c;b=CHILD(b,0);REQ(b,SYM.list_if);c++;if(2==NCH(b))return c;b=CHILD(b,2)}}REQ(b,SYM.listmaker);goog.asserts.assert(1<NCH(b));for(var d=astForExpr(a,CHILD(b,0)),e=function(a,b){var c=0,d=CHILD(b,1);a:for(;;){c++;REQ(d,SYM.list_for);if(5===NCH(d))d=CHILD(d,4);else return c;b:for(;;){REQ(d,SYM.list_iter);d=CHILD(d,0);if(d.type===SYM.list_for)continue a;else if(d.type===SYM.list_if)if(3===
NCH(d)){d=CHILD(d,2);continue b}else return c;break}break}}(a,b),f=[],g=CHILD(b,1),h=0;h<e;++h){REQ(g,SYM.list_for);var k=CHILD(g,1),l=astForExprlist(a,k,Store),m=astForTestlist(a,CHILD(g,3)),k=1===NCH(k)?new comprehension(l[0],m,[]):new comprehension(new Tuple(l,Store,g.lineno,g.col_offset),m,[]);if(5===NCH(g)){for(var g=CHILD(g,4),l=c(a,g),m=[],n=0;n<l;++n)REQ(g,SYM.list_iter),g=CHILD(g,0),REQ(g,SYM.list_if),m[n]=astForExpr(a,CHILD(g,1)),3===NCH(g)&&(g=CHILD(g,2));g.type===SYM.list_iter&&(g=CHILD(g,
0));k.ifs=m}f[h]=k}return new ListComp(d,f,b.lineno,b.col_offset)}
function astForFactor(a,b){if(CHILD(b,0).type===TOK.T_MINUS&&2===NCH(b)){var c=CHILD(b,1);if(c.type===SYM.factor&&1===NCH(c)&&(c=CHILD(c,0),c.type===SYM.power&&1===NCH(c)&&(c=CHILD(c,0),c.type===SYM.atom))){var d=CHILD(c,0);if(d.type===TOK.T_NUMBER)return d.value="-"+d.value,astForAtom(a,c)}}c=astForExpr(a,CHILD(b,1));switch(CHILD(b,0).type){case TOK.T_PLUS:return new UnaryOp(UAdd,c,b.lineno,b.col_offset);case TOK.T_MINUS:return new UnaryOp(USub,c,b.lineno,b.col_offset);case TOK.T_TILDE:return new UnaryOp(Invert,
c,b.lineno,b.col_offset)}goog.asserts.fail("unhandled factor")}function astForForStmt(a,b){var c=[];REQ(b,SYM.for_stmt);9===NCH(b)&&(c=astForSuite(a,CHILD(b,8)));var d=CHILD(b,1),e=astForExprlist(a,d,Store),d=1===NCH(d)?e[0]:new Tuple(e,Store,b.lineno,b.col_offset);return new For_(d,astForTestlist(a,CHILD(b,3)),astForSuite(a,CHILD(b,5)),c,b.lineno,b.col_offset)}
function astForCall(a,b,c){REQ(b,SYM.arglist);for(var d=0,e=0,f=0,g=0;g<NCH(b);++g){var h=CHILD(b,g);h.type===SYM.argument&&(1===NCH(h)?d++:CHILD(h,1).type===SYM.gen_for?f++:e++)}if(1<f||f&&(d||e))throw new Sk.builtin.SyntaxError("Generator expression must be parenthesized if not sole argument",a.c_filename,b.lineno);if(255<d+e+f)throw new Sk.builtin.SyntaxError("more than 255 arguments",a.c_filename,b.lineno);for(var f=[],k=[],e=d=0,l=null,m=null,g=0;g<NCH(b);++g)if(h=CHILD(b,g),h.type===SYM.argument)if(1===
NCH(h)){if(e)throw new Sk.builtin.SyntaxError("non-keyword arg after keyword arg",a.c_filename,b.lineno);if(l)throw new Sk.builtin.SyntaxError("only named arguments may follow *expression",a.c_filename,b.lineno);f[d++]=astForExpr(a,CHILD(h,0))}else if(CHILD(h,1).type===SYM.gen_for)f[d++]=astForGenexp(a,h);else{var n=astForExpr(a,CHILD(h,0));if(n.constructor===Lambda)throw new Sk.builtin.SyntaxError("lambda cannot contain assignment",a.c_filename,b.lineno);if(n.constructor!==Name)throw new Sk.builtin.SyntaxError("keyword can't be an expression",
a.c_filename,b.lineno);n=n.id;forbiddenCheck(a,CHILD(h,0),n,b.lineno);for(var p=0;p<e;++p)if(k[p].arg===n)throw new Sk.builtin.SyntaxError("keyword argument repeated",a.c_filename,b.lineno);k[e++]=new keyword(n,astForExpr(a,CHILD(h,2)))}else h.type===TOK.T_STAR?l=astForExpr(a,CHILD(b,++g)):h.type===TOK.T_DOUBLESTAR&&(m=astForExpr(a,CHILD(b,++g)));return new Call(c,f,k,l,m,c.lineno,c.col_offset)}
function astForTrailer(a,b,c){REQ(b,SYM.trailer);if(CHILD(b,0).type===TOK.T_LPAR)return 2===NCH(b)?new Call(c,[],[],null,null,b.lineno,b.col_offset):astForCall(a,CHILD(b,1),c);if(CHILD(b,0).type===TOK.T_DOT)return new Attribute(c,strobj(CHILD(b,1).value),Load,b.lineno,b.col_offset);REQ(CHILD(b,0),TOK.T_LSQB);REQ(CHILD(b,2),TOK.T_RSQB);b=CHILD(b,1);if(1===NCH(b))return new Subscript(c,astForSlice(a,CHILD(b,0)),Load,b.lineno,b.col_offset);for(var d=!0,e=[],f=0;f<NCH(b);f+=2){var g=astForSlice(a,CHILD(b,
f));g.constructor!==Index&&(d=!1);e[f/2]=g}if(!d)return new Subscript(c,new ExtSlice(e),Load,b.lineno,b.col_offset);a=[];for(f=0;f<e.length;++f)g=e[f],goog.asserts.assert(g.constructor===Index&&null!==g.value&&void 0!==g.value),a[f]=g.value;e=new Tuple(a,Load,b.lineno,b.col_offset);return new Subscript(c,new Index(e),Load,b.lineno,b.col_offset)}
function astForFlowStmt(a,b){var c;REQ(b,SYM.flow_stmt);c=CHILD(b,0);switch(c.type){case SYM.break_stmt:return new Break_(b.lineno,b.col_offset);case SYM.continue_stmt:return new Continue_(b.lineno,b.col_offset);case SYM.yield_stmt:return new Expr(astForExpr(a,CHILD(c,0)),b.lineno,b.col_offset);case SYM.return_stmt:return 1===NCH(c)?new Return_(null,b.lineno,b.col_offset):new Return_(astForTestlist(a,CHILD(c,1)),b.lineno,b.col_offset);case SYM.raise_stmt:if(1===NCH(c))return new Raise(null,null,null,
b.lineno,b.col_offset);if(2===NCH(c))return new Raise(astForExpr(a,CHILD(c,1)),null,null,b.lineno,b.col_offset);if(4===NCH(c))return new Raise(astForExpr(a,CHILD(c,1)),astForExpr(a,CHILD(c,3)),null,b.lineno,b.col_offset);if(6===NCH(c))return new Raise(astForExpr(a,CHILD(c,1)),astForExpr(a,CHILD(c,3)),astForExpr(a,CHILD(c,5)),b.lineno,b.col_offset);default:goog.asserts.fail("unexpected flow_stmt")}goog.asserts.fail("unhandled flow statement")}
function astForArguments(a,b){var c,d=null,e=null;if(b.type===SYM.parameters){if(2===NCH(b))return new arguments_([],null,null,[]);b=CHILD(b,1)}REQ(b,SYM.varargslist);for(var f=[],g=[],h=!1,k=0,l=0,m=0;k<NCH(b);)switch(c=CHILD(b,k),c.type){case SYM.fpdef:var n=0;a:for(;;){if(k+1<NCH(b)&&CHILD(b,k+1).type===TOK.T_EQUAL)g[l++]=astForExpr(a,CHILD(b,k+2)),k+=2,h=!0;else if(h){if(n)throw new Sk.builtin.SyntaxError("parenthesized arg with default",a.c_filename,b.lineno);throw new Sk.builtin.SyntaxError("non-default argument follows default argument",
a.c_filename,b.lineno);}if(3===NCH(c)){c=CHILD(c,1);if(1!==NCH(c))throw new Sk.builtin.SyntaxError("tuple parameter unpacking has been removed",a.c_filename,b.lineno);n=!0;c=CHILD(c,0);goog.asserts.assert(c.type===SYM.fpdef);continue a}if(CHILD(c,0).type===TOK.T_NAME){forbiddenCheck(a,b,CHILD(c,0).value,b.lineno);var p=strobj(CHILD(c,0).value);f[m++]=new Name(p,Param,c.lineno,c.col_offset)}k+=2;if(n)throw new Sk.builtin.SyntaxError("parenthesized argument names are invalid",a.c_filename,b.lineno);
break}break;case TOK.T_STAR:forbiddenCheck(a,CHILD(b,k+1),CHILD(b,k+1).value,b.lineno);d=strobj(CHILD(b,k+1).value);k+=3;break;case TOK.T_DOUBLESTAR:forbiddenCheck(a,CHILD(b,k+1),CHILD(b,k+1).value,b.lineno);e=strobj(CHILD(b,k+1).value);k+=3;break;default:goog.asserts.fail("unexpected node in varargslist")}return new arguments_(f,d,e,g)}
function astForFuncdef(a,b,c){REQ(b,SYM.funcdef);var d=strobj(CHILD(b,1).value);forbiddenCheck(a,CHILD(b,1),CHILD(b,1).value,b.lineno);var e=astForArguments(a,CHILD(b,2));a=astForSuite(a,CHILD(b,4));return new FunctionDef(d,e,a,c,b.lineno,b.col_offset)}function astForClassBases(a,b){goog.asserts.assert(0<NCH(b));REQ(b,SYM.testlist);return 1===NCH(b)?[astForExpr(a,CHILD(b,0))]:seqForTestlist(a,b)}
function astForClassdef(a,b,c){REQ(b,SYM.classdef);forbiddenCheck(a,b,CHILD(b,1).value,b.lineno);var d=strobj(CHILD(b,1).value);if(4===NCH(b))return new ClassDef(d,[],astForSuite(a,CHILD(b,3)),c,b.lineno,b.col_offset);if(CHILD(b,3).type===TOK.T_RPAR)return new ClassDef(d,[],astForSuite(a,CHILD(b,5)),c,b.lineno,b.col_offset);var e=astForClassBases(a,CHILD(b,3));a=astForSuite(a,CHILD(b,6));return new ClassDef(d,e,a,c,b.lineno,b.col_offset)}
function astForLambdef(a,b){var c,d;3===NCH(b)?(c=new arguments_([],null,null,[]),d=astForExpr(a,CHILD(b,2))):(c=astForArguments(a,CHILD(b,1)),d=astForExpr(a,CHILD(b,3)));return new Lambda(c,d,b.lineno,b.col_offset)}
function astForGenexp(a,b){function c(a,b){for(var c=0;;){REQ(b,SYM.gen_iter);if(CHILD(b,0).type===SYM.gen_for)return c;b=CHILD(b,0);REQ(b,SYM.gen_if);c++;if(2==NCH(b))return c;b=CHILD(b,2)}}goog.asserts.assert(b.type===SYM.testlist_gexp||b.type===SYM.argument);goog.asserts.assert(1<NCH(b));for(var d=astForExpr(a,CHILD(b,0)),e=function(a,b){var c=0,d=CHILD(b,1);a:for(;;){c++;REQ(d,SYM.gen_for);if(5===NCH(d))d=CHILD(d,4);else return c;b:for(;;){REQ(d,SYM.gen_iter);d=CHILD(d,0);if(d.type===SYM.gen_for)continue a;
else if(d.type===SYM.gen_if)if(3===NCH(d)){d=CHILD(d,2);continue b}else return c;break}break}goog.asserts.fail("logic error in countGenFors")}(a,b),f=[],g=CHILD(b,1),h=0;h<e;++h){REQ(g,SYM.gen_for);var k=CHILD(g,1),l=astForExprlist(a,k,Store),m=astForExpr(a,CHILD(g,3)),k=1===NCH(k)?new comprehension(l[0],m,[]):new comprehension(new Tuple(l,Store,g.lineno,g.col_offset),m,[]);if(5===NCH(g)){for(var g=CHILD(g,4),l=c(a,g),n=[],p=0;p<l;++p)REQ(g,SYM.gen_iter),g=CHILD(g,0),REQ(g,SYM.gen_if),m=astForExpr(a,
CHILD(g,1)),n[p]=m,3===NCH(g)&&(g=CHILD(g,2));g.type===SYM.gen_iter&&(g=CHILD(g,0));k.ifs=n}f[h]=k}return new GeneratorExp(d,f,b.lineno,b.col_offset)}
function astForWhileStmt(a,b){REQ(b,SYM.while_stmt);if(4===NCH(b))return new While_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),[],b.lineno,b.col_offset);if(7===NCH(b))return new While_(astForExpr(a,CHILD(b,1)),astForSuite(a,CHILD(b,3)),astForSuite(a,CHILD(b,6)),b.lineno,b.col_offset);goog.asserts.fail("wrong number of tokens for 'while' stmt")}
function astForAugassign(a,b){REQ(b,SYM.augassign);b=CHILD(b,0);switch(b.value.charAt(0)){case "+":return Add;case "-":return Sub;case "/":return"/"===b.value.charAt(1)?FloorDiv:Div;case "%":return Mod;case "<":return LShift;case ">":return RShift;case "&":return BitAnd;case "^":return BitXor;case "|":return BitOr;case "*":return"*"===b.value.charAt(1)?Pow:Mult;default:goog.asserts.fail("invalid augassign")}}
function astForBinop(a,b){for(var c=new BinOp(astForExpr(a,CHILD(b,0)),getOperator(CHILD(b,1)),astForExpr(a,CHILD(b,2)),b.lineno,b.col_offset),d=(NCH(b)-1)/2,e=1;e<d;++e)var f=CHILD(b,2*e+1),g=getOperator(f),h=astForExpr(a,CHILD(b,2*e+2)),c=new BinOp(c,g,h,f.lineno,f.col_offset);return c}
function astForTestlist(a,b){goog.asserts.assert(0<NCH(b));b.type===SYM.testlist_gexp?1<NCH(b)&&goog.asserts.assert(CHILD(b,1).type!==SYM.gen_for):goog.asserts.assert(b.type===SYM.testlist||b.type===SYM.testlist_safe||b.type===SYM.testlist1);return 1===NCH(b)?astForExpr(a,CHILD(b,0)):new Tuple(seqForTestlist(a,b),Load,b.lineno,b.col_offset)}
function astForExprStmt(a,b){REQ(b,SYM.expr_stmt);if(1===NCH(b))return new Expr(astForTestlist(a,CHILD(b,0)),b.lineno,b.col_offset);if(CHILD(b,1).type===SYM.augassign){var c=CHILD(b,0),d=astForTestlist(a,c);switch(d.constructor){case GeneratorExp:throw new Sk.builtin.SyntaxError("augmented assignment to generator expression not possible",a.c_filename,b.lineno);case Yield:throw new Sk.builtin.SyntaxError("augmented assignment to yield expression not possible",a.c_filename,b.lineno);case Name:forbiddenCheck(a,
c,d.id,b.lineno);break;case Attribute:case Subscript:break;default:throw new Sk.builtin.SyntaxError("illegal expression for augmented assignment",a.c_filename,b.lineno);}setContext(a,d,Store,c);c=CHILD(b,2);c=c.type===SYM.testlist?astForTestlist(a,c):astForExpr(a,c);return new AugAssign(d,astForAugassign(a,CHILD(b,1)),c,b.lineno,b.col_offset)}REQ(CHILD(b,1),TOK.T_EQUAL);for(var d=[],e=0;e<NCH(b)-2;e+=2){c=CHILD(b,e);if(c.type===SYM.yield_expr)throw new Sk.builtin.SyntaxError("assignment to yield expression not possible",
a.c_filename,b.lineno);c=astForTestlist(a,c);setContext(a,c,Store,CHILD(b,e));d[e/2]=c}c=CHILD(b,NCH(b)-1);c=c.type===SYM.testlist?astForTestlist(a,c):astForExpr(a,c);return new Assign(d,c,b.lineno,b.col_offset)}function astForIfexpr(a,b){goog.asserts.assert(5===NCH(b));return new IfExp(astForExpr(a,CHILD(b,2)),astForExpr(a,CHILD(b,0)),astForExpr(a,CHILD(b,4)),b.lineno,b.col_offset)}
function parsestr(a,b){var c=b.charAt(0),d=!1;if("u"===c||"U"===c)b=b.substr(1),c=b.charAt(0);else if("r"===c||"R"===c)b=b.substr(1),c=b.charAt(0),d=!0;goog.asserts.assert("b"!==c&&"B"!==c,"todo; haven't done b'' strings yet");goog.asserts.assert("'"===c||'"'===c&&b.charAt(b.length-1)===c);b=b.substr(1,b.length-2);4<=b.length&&(b.charAt(0)===c&&b.charAt(1)===c)&&(goog.asserts.assert(b.charAt(b.length-1)===c&&b.charAt(b.length-2)===c),b=b.substr(2,b.length-4));if(d||-1===b.indexOf("\\"))c=strobj(decodeURIComponent(escape(b)));
else{for(var c=strobj,d=b,e=d.length,f="",g=0;g<e;++g){var h=d.charAt(g);if("\\"===h)if(++g,h=d.charAt(g),"n"===h)f+="\n";else if("\\"===h)f+="\\";else if("t"===h)f+="\t";else if("r"===h)f+="\r";else if("b"===h)f+="\b";else if("f"===h)f+="\f";else if("v"===h)f+="\v";else if("0"===h)f+="\x00";else if('"'===h)f+='"';else if("'"===h)f+="'";else{if("\n"!==h)if("x"===h)var h=d.charAt(++g),k=d.charAt(++g),f=f+String.fromCharCode(parseInt(h+k,16));else if("u"===h||"U"===h)var h=d.charAt(++g),k=d.charAt(++g),
l=d.charAt(++g),m=d.charAt(++g),f=f+String.fromCharCode(parseInt(h+k,16),parseInt(l+m,16));else f+="\\"+h}else f+=h}c=c(f)}return c}function parsestrplus(a,b){REQ(CHILD(b,0),TOK.T_STRING);for(var c=new Sk.builtin.str(""),d=0;d<NCH(b);++d)try{c=c.sq$concat(parsestr(a,CHILD(b,d).value))}catch(e){throw new Sk.builtin.SyntaxError("invalid string (possibly contains a unicode character)",a.c_filename,CHILD(b,d).lineno);}return c}
function parsenumber(a,b,c){var d=b.charAt(b.length-1);if("j"===d||"J"===d)throw new Sk.builtin.SyntaxError("complex numbers are currently unsupported",a.c_filename,c);if("l"===d||"L"===d)return Sk.longFromStr(b.substr(0,b.length-1),0);if(-1!==b.indexOf("."))return new Sk.builtin.nmber(parseFloat(b),Sk.builtin.nmber.float$);c=b;a=!1;"-"===b.charAt(0)&&(c=b.substr(1),a=!0);if("0"!==c.charAt(0)||"x"!==c.charAt(1)&&"X"!==c.charAt(1)){if(-1!==b.indexOf("e")||-1!==b.indexOf("E"))return new Sk.builtin.nmber(parseFloat(b),
Sk.builtin.nmber.float$);if("0"!==c.charAt(0)||"b"!==c.charAt(1)&&"B"!==c.charAt(1))if("0"===c.charAt(0))if("0"===c)c=0;else{c=c.substring(1);if("o"===c.charAt(0)||"O"===c.charAt(0))c=c.substring(1);c=parseInt(c,8)}else c=parseInt(c,10);else c=c.substring(2),c=parseInt(c,2)}else c=c.substring(2),c=parseInt(c,16);return c>Sk.builtin.lng.threshold$&&Math.floor(c)===c&&-1===b.indexOf("e")&&-1===b.indexOf("E")?Sk.longFromStr(b,0):a?new Sk.builtin.nmber(-c,Sk.builtin.int$):new Sk.builtin.nmber(c,Sk.builtin.int$)}
function astForSlice(a,b){REQ(b,SYM.subscript);var c=CHILD(b,0),d=null,e=null,f=null;if(c.type===TOK.T_DOT)return new Ellipsis;if(1===NCH(b)&&c.type===SYM.test)return new Index(astForExpr(a,c));c.type===SYM.test&&(d=astForExpr(a,c));c.type===TOK.T_COLON?1<NCH(b)&&(c=CHILD(b,1),c.type===SYM.test&&(e=astForExpr(a,c))):2<NCH(b)&&(c=CHILD(b,2),c.type===SYM.test&&(e=astForExpr(a,c)));c=CHILD(b,NCH(b)-1);c.type===SYM.sliceop&&(1===NCH(c)?(c=CHILD(c,0),f=new Name(strobj("None"),Load,c.lineno,c.col_offset)):
(c=CHILD(c,1),c.type===SYM.test&&(f=astForExpr(a,c))));return new Slice(d,e,f)}
function astForAtom(a,b){var c=CHILD(b,0);switch(c.type){case TOK.T_NAME:return new Name(strobj(c.value),Load,b.lineno,b.col_offset);case TOK.T_STRING:return new Str(parsestrplus(a,b),b.lineno,b.col_offset);case TOK.T_NUMBER:return new Num(parsenumber(a,c.value,b.lineno),b.lineno,b.col_offset);case TOK.T_LPAR:return c=CHILD(b,1),c.type===TOK.T_RPAR?new Tuple([],Load,b.lineno,b.col_offset):c.type===SYM.yield_expr?astForExpr(a,c):1<NCH(c)&&CHILD(c,1).type===SYM.gen_for?astForGenexp(a,c):astForTestlistGexp(a,
c);case TOK.T_LSQB:c=CHILD(b,1);if(c.type===TOK.T_RSQB)return new List([],Load,b.lineno,b.col_offset);REQ(c,SYM.listmaker);return 1===NCH(c)||CHILD(c,1).type===TOK.T_COMMA?new List(seqForTestlist(a,c),Load,b.lineno,b.col_offset):astForListcomp(a,c);case TOK.T_LBRACE:c=CHILD(b,1);NCH(c);for(var d=[],e=[],f=0;f<NCH(c);f+=4)d[f/4]=astForExpr(a,CHILD(c,f)),e[f/4]=astForExpr(a,CHILD(c,f+2));return new Dict(d,e,b.lineno,b.col_offset);case TOK.T_BACKQUOTE:throw new Sk.builtin.SyntaxError("backquote not supported, use repr()",
a.c_filename,b.lineno);default:goog.asserts.fail("unhandled atom",c.type)}}function astForPower(a,b){REQ(b,SYM.power);var c=astForAtom(a,CHILD(b,0));if(1===NCH(b))return c;for(var d=1;d<NCH(b);++d){var e=CHILD(b,d);if(e.type!==SYM.trailer)break;e=astForTrailer(a,e,c);e.lineno=c.lineno;e.col_offset=c.col_offset;c=e}CHILD(b,NCH(b)-1).type===SYM.factor&&(d=astForExpr(a,CHILD(b,NCH(b)-1)),c=new BinOp(c,Pow,d,b.lineno,b.col_offset));return c}
function astForExpr(a,b){a:for(;;){switch(b.type){case SYM.test:case SYM.old_test:if(CHILD(b,0).type===SYM.lambdef||CHILD(b,0).type===SYM.old_lambdef)return astForLambdef(a,CHILD(b,0));if(1<NCH(b))return astForIfexpr(a,b);case SYM.or_test:case SYM.and_test:if(1===NCH(b)){b=CHILD(b,0);continue a}for(var c=[],d=0;d<NCH(b);d+=2)c[d/2]=astForExpr(a,CHILD(b,d));if("and"===CHILD(b,1).value)return new BoolOp(And,c,b.lineno,b.col_offset);goog.asserts.assert("or"===CHILD(b,1).value);return new BoolOp(Or,c,
b.lineno,b.col_offset);case SYM.not_test:if(1===NCH(b)){b=CHILD(b,0);continue a}else return new UnaryOp(Not,astForExpr(a,CHILD(b,1)),b.lineno,b.col_offset);case SYM.comparison:if(1===NCH(b)){b=CHILD(b,0);continue a}else{for(var c=[],e=[],d=1;d<NCH(b);d+=2)c[(d-1)/2]=astForCompOp(a,CHILD(b,d)),e[(d-1)/2]=astForExpr(a,CHILD(b,d+1));return new Compare(astForExpr(a,CHILD(b,0)),c,e,b.lineno,b.col_offset)}case SYM.expr:case SYM.xor_expr:case SYM.and_expr:case SYM.shift_expr:case SYM.arith_expr:case SYM.term:if(1===
NCH(b)){b=CHILD(b,0);continue a}return astForBinop(a,b);case SYM.yield_expr:return d=null,2===NCH(b)&&(d=astForTestlist(a,CHILD(b,1))),new Yield(d,b.lineno,b.col_offset);case SYM.factor:if(1===NCH(b)){b=CHILD(b,0);continue a}return astForFactor(a,b);case SYM.power:return astForPower(a,b);default:goog.asserts.fail("unhandled expr","n.type: %d",b.type)}break}}
function astForPrintStmt(a,b){var c=1,d=null;REQ(b,SYM.print_stmt);2<=NCH(b)&&CHILD(b,1).type===TOK.T_RIGHTSHIFT&&(d=astForExpr(a,CHILD(b,2)),c=4);for(var e=[],f=0;c<NCH(b);c+=2,++f)e[f]=astForExpr(a,CHILD(b,c));c=CHILD(b,NCH(b)-1).type===TOK.T_COMMA?!1:!0;return new Print(d,e,c,b.lineno,b.col_offset)}
function astForStmt(a,b){b.type===SYM.stmt&&(goog.asserts.assert(1===NCH(b)),b=CHILD(b,0));b.type===SYM.simple_stmt&&(goog.asserts.assert(1===numStmts(b)),b=CHILD(b,0));if(b.type===SYM.small_stmt)switch(REQ(b,SYM.small_stmt),b=CHILD(b,0),b.type){case SYM.expr_stmt:return astForExprStmt(a,b);case SYM.print_stmt:return astForPrintStmt(a,b);case SYM.del_stmt:return astForDelStmt(a,b);case SYM.pass_stmt:return new Pass(b.lineno,b.col_offset);case SYM.flow_stmt:return astForFlowStmt(a,b);case SYM.import_stmt:return astForImportStmt(a,
b);case SYM.global_stmt:return astForGlobalStmt(a,b);case SYM.exec_stmt:return astForExecStmt(a,b);case SYM.assert_stmt:return astForAssertStmt(a,b);default:goog.asserts.fail("unhandled small_stmt")}else{var c=CHILD(b,0);REQ(b,SYM.compound_stmt);switch(c.type){case SYM.if_stmt:return astForIfStmt(a,c);case SYM.while_stmt:return astForWhileStmt(a,c);case SYM.for_stmt:return astForForStmt(a,c);case SYM.try_stmt:return astForTryStmt(a,c);case SYM.with_stmt:return astForWithStmt(a,c);case SYM.funcdef:return astForFuncdef(a,
c,[]);case SYM.classdef:return astForClassdef(a,c,[]);case SYM.decorated:return astForDecorated(a,c);default:goog.asserts.assert("unhandled compound_stmt")}}}
Sk.astFromParse=function(a,b){var c=new Compiling("utf-8",b),d=[],e,f=0;switch(a.type){case SYM.file_input:for(var g=0;g<NCH(a)-1;++g)if(e=CHILD(a,g),a.type!==TOK.T_NEWLINE){REQ(e,SYM.stmt);var h=numStmts(e);if(1===h)d[f++]=astForStmt(c,e);else{e=CHILD(e,0);REQ(e,SYM.simple_stmt);for(var k=0;k<h;++k)d[f++]=astForStmt(c,CHILD(e,2*k))}}return new Module(d);case SYM.eval_input:goog.asserts.fail("todo;");case SYM.single_input:goog.asserts.fail("todo;");default:goog.asserts.fail("todo;")}};
Sk.astDump=function(a){var b=function(a){for(var b="",c=0;c<a;++c)b+=" ";return b},c=function(a,e){if(null===a)return e+"None";if(a.prototype&&void 0!==a.prototype._astname&&a.prototype._isenum)return e+a.prototype._astname+"()";if(void 0!==a._astname){for(var f=b(a._astname.length+1),g=[],h=0;h<a._fields.length;h+=2){var k=a._fields[h],l=a._fields[h+1](a),m=b(k.length+1);g.push([k,c(l,e+f+m)])}k=[];for(h=0;h<g.length;++h)l=g[h],k.push(l[0]+"="+l[1].replace(/^\s+/,""));h=k.join(",\n"+e+f);return e+
a._astname+"("+h+")"}if(goog.isArrayLike(a)){f=[];for(h=0;h<a.length;++h)f.push(c(a[h],e+" "));h=f.join(",\n");return e+"["+h.replace(/^\s+/,"")+"]"}h=!0===a?"True":!1===a?"False":a instanceof Sk.builtin.lng?a.tp$str().v:a instanceof Sk.builtin.str?a.$r().v:""+a;return e+h};return c(a,"")};goog.exportSymbol("Sk.astFromParse",Sk.astFromParse);goog.exportSymbol("Sk.astDump",Sk.astDump);var DEF_GLOBAL=1,DEF_LOCAL=2,DEF_PARAM=4,USE=8,DEF_STAR=16,DEF_DOUBLESTAR=32,DEF_INTUPLE=64,DEF_FREE=128,DEF_FREE_GLOBAL=256,DEF_FREE_CLASS=512,DEF_IMPORT=1024,DEF_BOUND=DEF_LOCAL|DEF_PARAM|DEF_IMPORT,SCOPE_OFF=11,SCOPE_MASK=7,LOCAL=1,GLOBAL_EXPLICIT=2,GLOBAL_IMPLICIT=3,FREE=4,CELL=5,OPT_IMPORT_STAR=1,OPT_EXEC=2,OPT_BARE_EXEC=4,OPT_TOPLEVEL=8,GENERATOR=2,GENERATOR_EXPRESSION=2,ModuleBlock="module",FunctionBlock="function",ClassBlock="class";
function Symbol(a,b,c){this.__name=a;this.__flags=b;this.__scope=b>>SCOPE_OFF&SCOPE_MASK;this.__namespaces=c||[]}Symbol.prototype.get_name=function(){return this.__name};Symbol.prototype.is_referenced=function(){return!!(this.__flags&USE)};Symbol.prototype.is_parameter=function(){return!!(this.__flags&DEF_PARAM)};Symbol.prototype.is_global=function(){return this.__scope===GLOBAL_IMPLICIT||this.__scope==GLOBAL_EXPLICIT};Symbol.prototype.is_declared_global=function(){return this.__scope==GLOBAL_EXPLICIT};
Symbol.prototype.is_local=function(){return!!(this.__flags&DEF_BOUND)};Symbol.prototype.is_free=function(){return this.__scope==FREE};Symbol.prototype.is_imported=function(){return!!(this.__flags&DEF_IMPORT)};Symbol.prototype.is_assigned=function(){return!!(this.__flags&DEF_LOCAL)};Symbol.prototype.is_namespace=function(){return this.__namespaces&&0<this.__namespaces.length};Symbol.prototype.get_namespaces=function(){return this.__namespaces};var astScopeCounter=0;
function SymbolTableScope(a,b,c,d,e){this.symFlags={};this.name=b;this.varnames=[];this.children=[];this.blockType=c;this.returnsValue=this.varkeywords=this.varargs=this.generator=this.childHasFree=this.hasFree=this.isNested=!1;this.lineno=e;this.table=a;a.cur&&(a.cur.nested||a.cur.blockType===FunctionBlock)&&(this.isNested=!0);d.scopeId=astScopeCounter++;a.stss[d.scopeId]=this;this.symbols={}}SymbolTableScope.prototype.get_type=function(){return this.blockType};
SymbolTableScope.prototype.get_name=function(){return this.name};SymbolTableScope.prototype.get_lineno=function(){return this.lineno};SymbolTableScope.prototype.is_nested=function(){return this.isNested};SymbolTableScope.prototype.has_children=function(){return 0<this.children.length};SymbolTableScope.prototype.get_identifiers=function(){return this._identsMatching(function(a){return!0})};
SymbolTableScope.prototype.lookup=function(a){if(this.symbols.hasOwnProperty(a))a=this.symbols[a];else{var b=this.symFlags[a],c=this.__check_children(a);a=this.symbols[a]=new Symbol(a,b,c)}return a};SymbolTableScope.prototype.__check_children=function(a){for(var b=[],c=0;c<this.children.length;++c){var d=this.children[c];d.name===a&&b.push(d)}return b};
SymbolTableScope.prototype._identsMatching=function(a){var b=[],c;for(c in this.symFlags)this.symFlags.hasOwnProperty(c)&&a(this.symFlags[c])&&b.push(c);b.sort();return b};SymbolTableScope.prototype.get_parameters=function(){goog.asserts.assert("function"==this.get_type(),"get_parameters only valid for function scopes");this._funcParams||(this._funcParams=this._identsMatching(function(a){return a&DEF_PARAM}));return this._funcParams};
SymbolTableScope.prototype.get_locals=function(){goog.asserts.assert("function"==this.get_type(),"get_locals only valid for function scopes");this._funcLocals||(this._funcLocals=this._identsMatching(function(a){return a&DEF_BOUND}));return this._funcLocals};
SymbolTableScope.prototype.get_globals=function(){goog.asserts.assert("function"==this.get_type(),"get_globals only valid for function scopes");this._funcGlobals||(this._funcGlobals=this._identsMatching(function(a){a=a>>SCOPE_OFF&SCOPE_MASK;return a==GLOBAL_IMPLICIT||a==GLOBAL_EXPLICIT}));return this._funcGlobals};
SymbolTableScope.prototype.get_frees=function(){goog.asserts.assert("function"==this.get_type(),"get_frees only valid for function scopes");this._funcFrees||(this._funcFrees=this._identsMatching(function(a){return(a>>SCOPE_OFF&SCOPE_MASK)==FREE}));return this._funcFrees};
SymbolTableScope.prototype.get_methods=function(){goog.asserts.assert("class"==this.get_type(),"get_methods only valid for class scopes");if(!this._classMethods){for(var a=[],b=0;b<this.children.length;++b)a.push(this.children[b].name);a.sort();this._classMethods=a}return this._classMethods};SymbolTableScope.prototype.getScope=function(a){a=this.symFlags[a];return void 0===a?0:a>>SCOPE_OFF&SCOPE_MASK};
function SymbolTable(a){this.filename=a;this.top=this.cur=null;this.stack=[];this.curClass=this.global=null;this.tmpname=0;this.stss={}}SymbolTable.prototype.getStsForAst=function(a){goog.asserts.assert(void 0!==a.scopeId,"ast wasn't added to st?");a=this.stss[a.scopeId];goog.asserts.assert(void 0!==a,"unknown sym tab entry");return a};
SymbolTable.prototype.SEQStmt=function(a){goog.asserts.assert(goog.isArrayLike(a),"SEQ: nodes isn't array? got %s",a);for(var b=a.length,c=0;c<b;++c){var d=a[c];d&&this.visitStmt(d)}};SymbolTable.prototype.SEQExpr=function(a){goog.asserts.assert(goog.isArrayLike(a),"SEQ: nodes isn't array? got %s",a);for(var b=a.length,c=0;c<b;++c){var d=a[c];d&&this.visitExpr(d)}};
SymbolTable.prototype.enterBlock=function(a,b,c,d){a=fixReservedNames(a);var e=null;this.cur&&(e=this.cur,this.stack.push(this.cur));this.cur=new SymbolTableScope(this,a,b,c,d);"top"===a&&(this.global=this.cur.symFlags);e&&e.children.push(this.cur)};SymbolTable.prototype.exitBlock=function(){this.cur=null;0<this.stack.length&&(this.cur=this.stack.pop())};
SymbolTable.prototype.visitParams=function(a,b){for(var c=0;c<a.length;++c){var d=a[c];if(d.constructor===Name)goog.asserts.assert(d.ctx===Param||d.ctx===Store&&!b),this.addDef(d.id,DEF_PARAM,d.lineno);else throw new Sk.builtin.SyntaxError("invalid expression in parameter list",this.filename);}};
SymbolTable.prototype.visitArguments=function(a,b){a.args&&this.visitParams(a.args,!0);a.vararg&&(this.addDef(a.vararg,DEF_PARAM,b),this.cur.varargs=!0);a.kwarg&&(this.addDef(a.kwarg,DEF_PARAM,b),this.cur.varkeywords=!0)};SymbolTable.prototype.newTmpname=function(a){this.addDef(new Sk.builtin.str("_["+ ++this.tmpname+"]"),DEF_LOCAL,a)};
SymbolTable.prototype.addDef=function(a,b,c){var d=mangleName(this.curClass,new Sk.builtin.str(a)).v,d=fixReservedNames(d),e=this.cur.symFlags[d];if(void 0!==e){if(b&DEF_PARAM&&e&DEF_PARAM)throw new Sk.builtin.SyntaxError("duplicate argument '"+a.v+"' in function definition",this.filename,c);e|=b}else e=b;this.cur.symFlags[d]=e;b&DEF_PARAM?this.cur.varnames.push(d):b&DEF_GLOBAL&&(e=b,a=this.global[d],void 0!==a&&(e|=a),this.global[d]=e)};
SymbolTable.prototype.visitSlice=function(a){switch(a.constructor){case Slice:a.lower&&this.visitExpr(a.lower);a.upper&&this.visitExpr(a.upper);a.step&&this.visitExpr(a.step);break;case ExtSlice:for(var b=0;b<a.dims.length;++b)this.visitSlice(a.dims[b]);break;case Index:this.visitExpr(a.value)}};
SymbolTable.prototype.visitStmt=function(a){goog.asserts.assert(void 0!==a,"visitStmt called with undefined");switch(a.constructor){case FunctionDef:this.addDef(a.name,DEF_LOCAL,a.lineno);a.args.defaults&&this.SEQExpr(a.args.defaults);a.decorator_list&&this.SEQExpr(a.decorator_list);this.enterBlock(a.name.v,FunctionBlock,a,a.lineno);this.visitArguments(a.args,a.lineno);this.SEQStmt(a.body);this.exitBlock();break;case ClassDef:this.addDef(a.name,DEF_LOCAL,a.lineno);this.SEQExpr(a.bases);a.decorator_list&&
this.SEQExpr(a.decorator_list);this.enterBlock(a.name.v,ClassBlock,a,a.lineno);var b=this.curClass;this.curClass=a.name;this.SEQStmt(a.body);this.curCalss=b;this.exitBlock();break;case Return_:if(a.value&&(this.visitExpr(a.value),this.cur.returnsValue=!0,this.cur.generator))throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename);break;case Delete_:this.SEQExpr(a.targets);break;case Assign:this.SEQExpr(a.targets);this.visitExpr(a.value);break;case AugAssign:this.visitExpr(a.target);
this.visitExpr(a.value);break;case Print:a.dest&&this.visitExpr(a.dest);this.SEQExpr(a.values);break;case For_:this.visitExpr(a.target);this.visitExpr(a.iter);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case While_:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case If_:this.visitExpr(a.test);this.SEQStmt(a.body);a.orelse&&this.SEQStmt(a.orelse);break;case Raise:a.type&&(this.visitExpr(a.type),a.inst&&(this.visitExpr(a.inst),a.tback&&this.visitExpr(a.tback)));
break;case TryExcept:this.SEQStmt(a.body);this.SEQStmt(a.orelse);this.visitExcepthandlers(a.handlers);break;case TryFinally:this.SEQStmt(a.body);this.SEQStmt(a.finalbody);break;case Assert:this.visitExpr(a.test);a.msg&&this.visitExpr(a.msg);break;case Import_:case ImportFrom:this.visitAlias(a.names,a.lineno);break;case Exec:this.visitExpr(a.body);a.globals&&(this.visitExpr(a.globals),a.locals&&this.visitExpr(a.locals));break;case Global:for(var b=a.names.length,c=0;c<b;++c){var d=mangleName(this.curClass,
a.names[c]).v,d=fixReservedNames(d),e=this.cur.symFlags[d];if(e&(DEF_LOCAL|USE)){if(e&DEF_LOCAL)throw new Sk.builtin.SyntaxError("name '"+d+"' is assigned to before global declaration",this.filename,a.lineno);throw new Sk.builtin.SyntaxError("name '"+d+"' is used prior to global declaration",this.filename,a.lineno);}this.addDef(new Sk.builtin.str(d),DEF_GLOBAL,a.lineno)}break;case Expr:this.visitExpr(a.value);break;case Pass:case Break_:case Continue_:break;case With_:this.newTmpname(a.lineno);this.visitExpr(a.context_expr);
a.optional_vars&&(this.newTmpname(a.lineno),this.visitExpr(a.optional_vars));this.SEQStmt(a.body);break;default:goog.asserts.fail("Unhandled type "+a.constructor.name+" in visitStmt")}};
SymbolTable.prototype.visitExpr=function(a){goog.asserts.assert(void 0!==a,"visitExpr called with undefined");switch(a.constructor){case BoolOp:this.SEQExpr(a.values);break;case BinOp:this.visitExpr(a.left);this.visitExpr(a.right);break;case UnaryOp:this.visitExpr(a.operand);break;case Lambda:this.addDef(new Sk.builtin.str("lambda"),DEF_LOCAL,a.lineno);a.args.defaults&&this.SEQExpr(a.args.defaults);this.enterBlock("lambda",FunctionBlock,a,a.lineno);this.visitArguments(a.args,a.lineno);this.visitExpr(a.body);
this.exitBlock();break;case IfExp:this.visitExpr(a.test);this.visitExpr(a.body);this.visitExpr(a.orelse);break;case Dict:this.SEQExpr(a.keys);this.SEQExpr(a.values);break;case ListComp:this.newTmpname(a.lineno);this.visitExpr(a.elt);this.visitComprehension(a.generators,0);break;case GeneratorExp:this.visitGenexp(a);break;case Yield:a.value&&this.visitExpr(a.value);this.cur.generator=!0;if(this.cur.returnsValue)throw new Sk.builtin.SyntaxError("'return' with argument inside generator",this.filename);
break;case Compare:this.visitExpr(a.left);this.SEQExpr(a.comparators);break;case Call:this.visitExpr(a.func);this.SEQExpr(a.args);for(var b=0;b<a.keywords.length;++b)this.visitExpr(a.keywords[b].value);a.starargs&&this.visitExpr(a.starargs);a.kwargs&&this.visitExpr(a.kwargs);break;case Num:case Str:break;case Attribute:this.visitExpr(a.value);break;case Subscript:this.visitExpr(a.value);this.visitSlice(a.slice);break;case Name:this.addDef(a.id,a.ctx===Load?USE:DEF_LOCAL,a.lineno);break;case List:case Tuple:this.SEQExpr(a.elts);
break;default:goog.asserts.fail("Unhandled type "+a.constructor.name+" in visitExpr")}};SymbolTable.prototype.visitComprehension=function(a,b){for(var c=a.length,d=b;d<c;++d){var e=a[d];this.visitExpr(e.target);this.visitExpr(e.iter);this.SEQExpr(e.ifs)}};
SymbolTable.prototype.visitAlias=function(a,b){for(var c=0;c<a.length;++c){var d=a[c],e=d=null===d.asname?d.name.v:d.asname.v,f=d.indexOf(".");-1!==f&&(e=d.substr(0,f));if("*"!==d)this.addDef(new Sk.builtin.str(e),DEF_IMPORT,b);else if(this.cur.blockType!==ModuleBlock)throw new Sk.builtin.SyntaxError("import * only allowed at module level",this.filename);}};
SymbolTable.prototype.visitGenexp=function(a){var b=a.generators[0];this.visitExpr(b.iter);this.enterBlock("genexpr",FunctionBlock,a,a.lineno);this.cur.generator=!0;this.addDef(new Sk.builtin.str(".0"),DEF_PARAM,a.lineno);this.visitExpr(b.target);this.SEQExpr(b.ifs);this.visitComprehension(a.generators,1);this.visitExpr(a.elt);this.exitBlock()};SymbolTable.prototype.visitExcepthandlers=function(a){for(var b=0,c;c=a[b];++b)c.type&&this.visitExpr(c.type),c.name&&this.visitExpr(c.name),this.SEQStmt(c.body)};
function _dictUpdate(a,b){for(var c in b)a[c]=b[c]}
SymbolTable.prototype.analyzeBlock=function(a,b,c,d){var e={},f={},g={},h={},k={};a.blockType==ClassBlock&&(_dictUpdate(g,d),b&&_dictUpdate(h,b));for(var l in a.symFlags)this.analyzeName(a,f,l,a.symFlags[l],b,e,c,d);a.blockType!==ClassBlock&&(a.blockType===FunctionBlock&&_dictUpdate(h,e),b&&_dictUpdate(h,b),_dictUpdate(g,d));d={};e=a.children.length;for(l=0;l<e;++l){var m=a.children[l];this.analyzeChildBlock(m,h,k,g,d);if(m.hasFree||m.childHasFree)a.childHasFree=!0}_dictUpdate(k,d);a.blockType===
FunctionBlock&&this.analyzeCells(f,k);this.updateSymbols(a.symFlags,f,b,k,a.blockType===ClassBlock);_dictUpdate(c,k)};SymbolTable.prototype.analyzeChildBlock=function(a,b,c,d,e){var f={};_dictUpdate(f,b);b={};_dictUpdate(b,c);c={};_dictUpdate(c,d);this.analyzeBlock(a,f,b,c);_dictUpdate(e,b)};SymbolTable.prototype.analyzeCells=function(a,b){for(var c in a)a[c]===LOCAL&&void 0!==b[c]&&(a[c]=CELL,delete b[c])};
SymbolTable.prototype.updateSymbols=function(a,b,c,d,e){for(var f in a){var g=a[f],g=g|b[f]<<SCOPE_OFF;a[f]=g}b=FREE<<SCOPE_OFF;for(f in d)d=a[f],void 0!==d?e&&d&(DEF_BOUND|DEF_GLOBAL)&&(a[f]=d|DEF_FREE_CLASS):void 0!==c[f]&&(a[f]=b)};
SymbolTable.prototype.analyzeName=function(a,b,c,d,e,f,g,h){if(d&DEF_GLOBAL){if(d&DEF_PARAM)throw new Sk.builtin.SyntaxError("name '"+c+"' is local and global",this.filename,a.lineno);b[c]=GLOBAL_EXPLICIT;h[c]=null;e&&void 0!==e[c]&&delete e[c]}else d&DEF_BOUND?(b[c]=LOCAL,f[c]=null,delete h[c]):e&&void 0!==e[c]?(b[c]=FREE,a.hasFree=!0,g[c]=null):(h&&void 0!==h[c]||!a.isNested||(a.hasFree=!0),b[c]=GLOBAL_IMPLICIT)};SymbolTable.prototype.analyze=function(){this.analyzeBlock(this.top,null,{},{})};
Sk.symboltable=function(a,b){var c=new SymbolTable(b);c.enterBlock("top",ModuleBlock,a,0);c.top=c.cur;for(var d=0;d<a.body.length;++d)c.visitStmt(a.body[d]);c.exitBlock();c.analyze();return c};
Sk.dumpSymtab=function(a){var b=function(a){return a?"True":"False"},c=function(a){for(var b=[],c=0;c<a.length;++c)b.push((new Sk.builtin.str(a[c])).$r().v);return"["+b.join(", ")+"]"},d=function(a,f){void 0===f&&(f="");var g;g=""+(f+"Sym_type: "+a.get_type()+"\n");g+=f+"Sym_name: "+a.get_name()+"\n";g+=f+"Sym_lineno: "+a.get_lineno()+"\n";g+=f+"Sym_nested: "+b(a.is_nested())+"\n";g+=f+"Sym_haschildren: "+b(a.has_children())+"\n";"class"===a.get_type()?g+=f+"Class_methods: "+c(a.get_methods())+"\n":
"function"===a.get_type()&&(g+=f+"Func_params: "+c(a.get_parameters())+"\n",g+=f+"Func_locals: "+c(a.get_locals())+"\n",g+=f+"Func_globals: "+c(a.get_globals())+"\n",g+=f+"Func_frees: "+c(a.get_frees())+"\n");g+=f+"-- Identifiers --\n";for(var h=a.get_identifiers(),k=h.length,l=0;l<k;++l){var m=a.lookup(h[l]);g+=f+"name: "+m.get_name()+"\n";g+=f+" is_referenced: "+b(m.is_referenced())+"\n";g+=f+" is_imported: "+b(m.is_imported())+"\n";g+=f+" is_parameter: "+b(m.is_parameter())+"\n";g+=f+" is_global: "+
b(m.is_global())+"\n";g+=f+" is_declared_global: "+b(m.is_declared_global())+"\n";g+=f+" is_local: "+b(m.is_local())+"\n";g+=f+" is_free: "+b(m.is_free())+"\n";g+=f+" is_assigned: "+b(m.is_assigned())+"\n";g+=f+" is_namespace: "+b(m.is_namespace())+"\n";var m=m.get_namespaces(),n=m.length;g+=f+" namespaces: [\n";for(var p=[],q=0;q<n;++q)p.push(d(m[q],f+" "));g+=p.join("\n");g+=f+" ]\n"}return g};return d(a.top,"")};goog.exportSymbol("Sk.symboltable",Sk.symboltable);
goog.exportSymbol("Sk.dumpSymtab",Sk.dumpSymtab);var out;Sk.gensymcount=0;function Compiler(a,b,c,d){this.filename=a;this.st=b;this.flags=c;this.interactive=!1;this.nestlevel=0;this.u=null;this.stack=[];this.result=[];this.allUnits=[];this.source=d?d.split("\n"):!1}
function CompilerUnit(){this.private_=this.name=this.ste=null;this.lineno=this.firstlineno=0;this.linenoSet=!1;this.localnames=[];this.blocknum=0;this.blocks=[];this.curblock=0;this.scopename=null;this.suffixCode=this.switchCode=this.varDeclsCode=this.prefixCode="";this.breakBlocks=[];this.continueBlocks=[];this.exceptBlocks=[];this.finallyBlocks=[]}CompilerUnit.prototype.activateScope=function(){var a=this;out=function(){for(var b=a.blocks[a.curblock],c=0;c<arguments.length;++c)b.push(arguments[c])}};
Compiler.prototype.getSourceLine=function(a){goog.asserts.assert(this.source);return this.source[a-1]};Compiler.prototype.annotateSource=function(a){if(this.source){var b=a.lineno;a=a.col_offset;out("\n//\n// line ",b,":\n// ",this.getSourceLine(b),"\n// ");for(var c=0;c<a;++c)out(" ");out("^\n//\n");out("\nSk.currLineNo = ",b,";\nSk.currColNo = ",a,"\n\n");out("\nSk.currFilename = '",this.filename,"';\n\n")}};Compiler.prototype.gensym=function(a){a="$"+(a||"");return a+=Sk.gensymcount++};
Compiler.prototype.niceName=function(a){return this.gensym(a.replace("<","").replace(">","").replace(" ","_"))};
var reservedWords_={"abstract":!0,as:!0,"boolean":!0,"break":!0,"byte":!0,"case":!0,"catch":!0,"char":!0,"class":!0,"continue":!0,"const":!0,"debugger":!0,"default":!0,"delete":!0,"do":!0,"double":!0,"else":!0,"enum":!0,"export":!0,"extends":!0,"false":!0,"final":!0,"finally":!0,"float":!0,"for":!0,"function":!0,"goto":!0,"if":!0,"implements":!0,"import":!0,"in":!0,"instanceof":!0,"int":!0,"interface":!0,is:!0,"long":!0,namespace:!0,"native":!0,"new":!0,"null":!0,"package":!0,"private":!0,"protected":!0,
"public":!0,"return":!0,"short":!0,"static":!0,"super":!1,"switch":!0,"synchronized":!0,"this":!0,"throw":!0,"throws":!0,"transient":!0,"true":!0,"try":!0,"typeof":!0,use:!0,"var":!0,"void":!0,"volatile":!0,"while":!0,"with":!0};function fixReservedWords(a){return!0!==reservedWords_[a]?a:a+"_$rw$"}
var reservedNames_={__defineGetter__:!0,__defineSetter__:!0,apply:!0,call:!0,eval:!0,hasOwnProperty:!0,isPrototypeOf:!0,__lookupGetter__:!0,__lookupSetter__:!0,__noSuchMethod__:!0,propertyIsEnumerable:!0,toSource:!0,toLocaleString:!0,toString:!0,unwatch:!0,valueOf:!0,watch:!0,length:!0};function fixReservedNames(a){return reservedNames_[a]?a+"_$rn$":a}
function mangleName(a,b){var c=b.v,d=null;if(null===a||(null===c||"_"!==c.charAt(0)||"_"!==c.charAt(1))||"_"===c.charAt(c.length-1)&&"_"===c.charAt(c.length-2))return b;d=a.v;d.replace(/_/g,"");if(""===d)return b;d=a.v;d.replace(/^_*/,"");return d=new Sk.builtin.str("_"+d+c)}Compiler.prototype._gr=function(a,b){var c=this.gensym(a);out("var ",c,"=");for(var d=1;d<arguments.length;++d)out(arguments[d]);out(";");return c};
Compiler.prototype._interruptTest=function(){out("if (Sk.execStart === undefined) {Sk.execStart=new Date()}");out("if (Sk.execLimit != null && new Date() - Sk.execStart > Sk.execLimit) {throw new Sk.builtin.TimeLimitError(Sk.timeoutMsg())}")};Compiler.prototype._jumpfalse=function(a,b){var c=this._gr("jfalse","(",a,"===false||!Sk.misceval.isTrue(",a,"))");this._interruptTest();out("if(",c,"){/*test failed */$blk=",b,";continue;}")};
Compiler.prototype._jumpundef=function(a,b){this._interruptTest();out("if(",a,"===undefined){$blk=",b,";continue;}")};Compiler.prototype._jumptrue=function(a,b){var c=this._gr("jtrue","(",a,"===true||Sk.misceval.isTrue(",a,"))");this._interruptTest();out("if(",c,"){/*test passed */$blk=",b,";continue;}")};Compiler.prototype._jump=function(a){this._interruptTest();out("$blk=",a,";/* jump */continue;")};
Compiler.prototype.ctupleorlist=function(a,b,c){goog.asserts.assert("tuple"===c||"list"===c);if(a.ctx===Store)for(var d=0;d<a.elts.length;++d)this.vexpr(a.elts[d],"Sk.abstr.objectGetItem("+b+","+d+")");else if(a.ctx===Load){b=[];for(d=0;d<a.elts.length;++d)b.push(this._gr("elem",this.vexpr(a.elts[d])));return this._gr("load"+c,"new Sk.builtins['",c,"']([",b,"])")}};
Compiler.prototype.cdict=function(a){goog.asserts.assert(a.values.length===a.keys.length);for(var b=[],c=0;c<a.values.length;++c){var d=this.vexpr(a.values[c]);b.push(this.vexpr(a.keys[c]));b.push(d)}return this._gr("loaddict","new Sk.builtins['dict']([",b,"])")};
Compiler.prototype.clistcompgen=function(a,b,c,d){var e=this.newBlock("list gen start"),f=this.newBlock("list gen skip"),g=this.newBlock("list gen anchor"),h=b[c],k=this.vexpr(h.iter),k=this._gr("iter","Sk.abstr.iter(",k,")");this._jump(e);this.setBlock(e);k=this._gr("next","Sk.abstr.iternext(",k,")");this._jumpundef(k,g);this.vexpr(h.target,k);for(var k=h.ifs.length,l=0;l<k;++l){var m=this.vexpr(h.ifs[l]);this._jumpfalse(m,e)}++c<b.length&&this.clistcompgen(a,b,c,d);c>=b.length&&(b=this.vexpr(d),
out(a,".v.push(",b,");"),this._jump(f),this.setBlock(f));this._jump(e);this.setBlock(g);return a};Compiler.prototype.clistcomp=function(a){goog.asserts.assert(a instanceof ListComp);var b=this._gr("_compr","new Sk.builtins['list']([])");return this.clistcompgen(b,a.generators,0,a.elt)};
Compiler.prototype.cyield=function(a){if(this.u.ste.blockType!==FunctionBlock)throw new SyntaxError("'yield' outside function");var b="null";a.value&&(b=this.vexpr(a.value));a=this.newBlock("after yield");out("return [/*resume*/",a,",/*ret*/",b,"];");this.setBlock(a);return"$gen.gi$sentvalue"};
Compiler.prototype.ccompare=function(a){goog.asserts.assert(a.ops.length===a.comparators.length);for(var b=this.vexpr(a.left),c=a.ops.length,d=this.newBlock("done"),e=this._gr("compareres","null"),f=0;f<c;++f){var g=this.vexpr(a.comparators[f]),b=this._gr("compare","Sk.builtin.bool(Sk.misceval.richCompareBool(",b,",",g,",'",a.ops[f].prototype._astname,"'))");out(e,"=",b,";");this._jumpfalse(b,d);b=g}this._jump(d);this.setBlock(d);return e};
Compiler.prototype.ccall=function(a){var b=this.vexpr(a.func),c=this.vseqexpr(a.args);if(0<a.keywords.length||a.starargs||a.kwargs){for(var d=[],e=0;e<a.keywords.length;++e)d.push("'"+a.keywords[e].arg.v+"'"),d.push(this.vexpr(a.keywords[e].value));var d="["+d.join(",")+"]",f=e="undefined";a.starargs&&(e=this.vexpr(a.starargs));a.kwargs&&(f=this.vexpr(a.kwargs));return this._gr("call","Sk.misceval.call(",b,",",f,",",e,",",d,0<c.length?",":"",c,")")}return this._gr("call","Sk.misceval.callsim(",b,
0<c.length?",":"",c,")")};Compiler.prototype.cslice=function(a){goog.asserts.assert(a instanceof Slice);var b=a.lower?this.vexpr(a.lower):"null",c=a.upper?this.vexpr(a.upper):"null";a=a.step?this.vexpr(a.step):"null";return this._gr("slice","new Sk.builtins['slice'](",b,",",c,",",a,")")};
Compiler.prototype.vslicesub=function(a){var b;switch(a.constructor){case Number:case String:b=a;break;case Index:b=this.vexpr(a.value);break;case Slice:b=this.cslice(a);break;case Ellipsis:case ExtSlice:goog.asserts.fail("todo;");break;default:goog.asserts.fail("invalid subscript kind")}return b};Compiler.prototype.vslice=function(a,b,c,d){a=this.vslicesub(a);return this.chandlesubscr(b,c,a,d)};
Compiler.prototype.chandlesubscr=function(a,b,c,d){if(a===Load||a===AugLoad)return this._gr("lsubscr","Sk.abstr.objectGetItem(",b,",",c,")");a===Store||a===AugStore?out("Sk.abstr.objectSetItem(",b,",",c,",",d,");"):a===Del?out("Sk.abstr.objectDelItem(",b,",",c,");"):goog.asserts.fail("handlesubscr fail")};
Compiler.prototype.cboolop=function(a){goog.asserts.assert(a instanceof BoolOp);var b;b=a.op===And?this._jumpfalse:this._jumptrue;var c=this.newBlock("end of boolop");a=a.values;for(var d=a.length,e,f=0;f<d;++f){var g=this.vexpr(a[f]);0===f&&(e=this._gr("boolopsucc",g));out(e,"=",g,";");b.call(this,g,c)}this._jump(c);this.setBlock(c);return e};
Compiler.prototype.vexpr=function(a,b,c){a.lineno>this.u.lineno&&(this.u.lineno=a.lineno,this.u.linenoSet=!1);switch(a.constructor){case BoolOp:return this.cboolop(a);case BinOp:return this._gr("binop","Sk.abstr.numberBinOp(",this.vexpr(a.left),",",this.vexpr(a.right),",'",a.op.prototype._astname,"')");case UnaryOp:return this._gr("unaryop","Sk.abstr.numberUnaryOp(",this.vexpr(a.operand),",'",a.op.prototype._astname,"')");case Lambda:return this.clambda(a);case IfExp:return this.cifexp(a);case Dict:return this.cdict(a);
case ListComp:return this.clistcomp(a);case GeneratorExp:return this.cgenexp(a);case Yield:return this.cyield(a);case Compare:return this.ccompare(a);case Call:return b=this.ccall(a),this.annotateSource(a),b;case Num:if("number"===typeof a.n)return a.n;if(a.n instanceof Sk.builtin.nmber)return"new Sk.builtin.nmber("+a.n.v+",'"+a.n.skType+"')";if(a.n instanceof Sk.builtin.lng)return"Sk.longFromStr('"+a.n.tp$str().v+"')";goog.asserts.fail("unhandled Num type");case Str:return this._gr("str","new Sk.builtins['str'](",
a.s.$r().v,")");case Attribute:var d;a.ctx!==AugStore&&(d=this.vexpr(a.value));var e=a.attr.$r().v,e=e.substring(1,e.length-1),e=mangleName(this.u.private_,new Sk.builtin.str(e)).v,e=fixReservedWords(e),e=fixReservedNames(e);switch(a.ctx){case AugLoad:case Load:return this._gr("lattr","Sk.abstr.gattr(",d,",'",e,"')");case AugStore:out("if(",b,"!==undefined){");d=this.vexpr(c||null);out("Sk.abstr.sattr(",d,",'",e,"',",b,");");out("}");break;case Store:out("Sk.abstr.sattr(",d,",'",e,"',",b,");");break;
case Del:goog.asserts.fail("todo;");break;default:goog.asserts.fail("invalid attribute expression")}break;case Subscript:switch(a.ctx){case AugLoad:case Load:case Store:case Del:return this.vslice(a.slice,a.ctx,this.vexpr(a.value),b);case AugStore:out("if(",b,"!==undefined){");d=this.vexpr(c||null);this.vslice(a.slice,a.ctx,d,b);out("}");break;default:goog.asserts.fail("invalid subscript expression")}break;case Name:return this.nameop(a.id,a.ctx,b);case List:return this.ctupleorlist(a,b,"list");case Tuple:return this.ctupleorlist(a,
b,"tuple");default:goog.asserts.fail("unhandled case in vexpr")}};Compiler.prototype.vseqexpr=function(a,b){goog.asserts.assert(void 0===b||a.length===b.length);for(var c=[],d=0;d<a.length;++d)c.push(this.vexpr(a[d],void 0===b?void 0:b[d]));return c};
Compiler.prototype.caugassign=function(a){goog.asserts.assert(a instanceof AugAssign);var b=a.target;switch(b.constructor){case Attribute:var c=new Attribute(b.value,b.attr,AugLoad,b.lineno,b.col_offset),d=this.vexpr(c),e=this.vexpr(a.value);a=this._gr("inplbinopattr","Sk.abstr.numberInplaceBinOp(",d,",",e,",'",a.op.prototype._astname,"')");c.ctx=AugStore;return this.vexpr(c,a,b.value);case Subscript:return c=this.vslicesub(b.slice),c=new Subscript(b.value,c,AugLoad,b.lineno,b.col_offset),d=this.vexpr(c),
e=this.vexpr(a.value),a=this._gr("inplbinopsubscr","Sk.abstr.numberInplaceBinOp(",d,",",e,",'",a.op.prototype._astname,"')"),c.ctx=AugStore,this.vexpr(c,a,b.value);case Name:return c=this.nameop(b.id,Load),e=this.vexpr(a.value),a=this._gr("inplbinop","Sk.abstr.numberInplaceBinOp(",c,",",e,",'",a.op.prototype._astname,"')"),this.nameop(b.id,Store,a);default:goog.asserts.fail("unhandled case in augassign")}};
Compiler.prototype.exprConstant=function(a){switch(a.constructor){case Num:return Sk.misceval.isTrue(a.n);case Str:return Sk.misceval.isTrue(a.s);default:return-1}};Compiler.prototype.newBlock=function(a){var b=this.u.blocknum++;this.u.blocks[b]=[];this.u.blocks[b]._name=a||"<unnamed>";return b};Compiler.prototype.setBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.curblock=a};Compiler.prototype.pushBreakBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.breakBlocks.push(a)};
Compiler.prototype.popBreakBlock=function(){this.u.breakBlocks.pop()};Compiler.prototype.pushContinueBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.continueBlocks.push(a)};Compiler.prototype.popContinueBlock=function(){this.u.continueBlocks.pop()};Compiler.prototype.pushExceptBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.exceptBlocks.push(a)};Compiler.prototype.popExceptBlock=function(){this.u.exceptBlocks.pop()};
Compiler.prototype.pushFinallyBlock=function(a){goog.asserts.assert(0<=a&&a<this.u.blocknum);this.u.finallyBlocks.push(a)};Compiler.prototype.popFinallyBlock=function(){this.u.finallyBlocks.pop()};Compiler.prototype.setupExcept=function(a){out("$exc.push(",a,");")};Compiler.prototype.endExcept=function(){out("$exc.pop();")};
Compiler.prototype.outputLocals=function(a){for(var b={},c=0;a.argnames&&c<a.argnames.length;++c)b[a.argnames[c]]=!0;a.localnames.sort();for(var d=[],c=0;c<a.localnames.length;++c){var e=a.localnames[c];void 0===b[e]&&(d.push(e),b[e]=!0)}return 0<d.length?"var "+d.join(",")+"; /* locals */":""};
Compiler.prototype.outputAllUnits=function(){for(var a="",b=0;b<this.allUnits.length;++b){for(var c=this.allUnits[b],a=a+c.prefixCode,a=a+this.outputLocals(c),a=a+c.varDeclsCode,a=a+c.switchCode,d=c.blocks,e=0;e<d.length;++e)a+="case "+e+": /* --- "+d[e]._name+" --- */",a+=d[e].join(""),a+="throw new Sk.builtin.SystemError('internal error: unterminated block');";a+=c.suffixCode}return a};
Compiler.prototype.cif=function(a){goog.asserts.assert(a instanceof If_);var b=this.exprConstant(a.test);if(0===b)a.orelse&&this.vseqstmt(a.orelse);else if(1===b)this.vseqstmt(a.body);else{var c=this.newBlock("end of if"),b=this.newBlock("next branch of if"),d=this.vexpr(a.test);this._jumpfalse(d,b);this.vseqstmt(a.body);this._jump(c);this.setBlock(b);a.orelse&&this.vseqstmt(a.orelse);this._jump(c)}this.setBlock(c)};
Compiler.prototype.cwhile=function(a){if(0===this.exprConstant(a.test))a.orelse&&this.vseqstmt(a.orelse);else{var b=this.newBlock("while test");this._jump(b);this.setBlock(b);var c=this.newBlock("after while"),d=0<a.orelse.length?this.newBlock("while orelse"):null,e=this.newBlock("while body");this._jumpfalse(this.vexpr(a.test),d?d:c);this._jump(e);this.pushBreakBlock(c);this.pushContinueBlock(b);this.setBlock(e);this.vseqstmt(a.body);this._jump(b);this.popContinueBlock();this.popBreakBlock();0<a.orelse.length&&
(this.setBlock(d),this.vseqstmt(a.orelse),this._jump(c));this.setBlock(c)}};
Compiler.prototype.cfor=function(a){var b=this.newBlock("for start"),c=this.newBlock("for cleanup"),d=this.newBlock("for end");this.pushBreakBlock(d);this.pushContinueBlock(b);var e=this.vexpr(a.iter),f;this.u.ste.generator?(f="$loc."+this.gensym("iter"),out(f,"=Sk.abstr.iter(",e,");")):f=this._gr("iter","Sk.abstr.iter(",e,")");this._jump(b);this.setBlock(b);e=this._gr("next","Sk.abstr.iternext(",f,")");this._jumpundef(e,c);this.vexpr(a.target,e);this.vseqstmt(a.body);this._jump(b);this.setBlock(c);
this.popContinueBlock();this.popBreakBlock();this.vseqstmt(a.orelse);this._jump(d);this.setBlock(d)};Compiler.prototype.craise=function(a){if(a&&a.type&&a.type.id&&"StopIteration"===a.type.id.v)out("return undefined;");else{var b="";a.inst?(b=this.vexpr(a.inst),out("throw ",this.vexpr(a.type),"(",b,");")):a.type?a.type.func?out("throw ",this.vexpr(a.type),";"):out("throw ",this.vexpr(a.type),"('');"):out("throw $err;")}};
Compiler.prototype.ctryexcept=function(a){for(var b=a.handlers.length,c=[],d=0;d<b;++d)c.push(this.newBlock("except_"+d+"_"));var e=this.newBlock("unhandled"),f=this.newBlock("orelse"),g=this.newBlock("end");this.setupExcept(c[0]);this.vseqstmt(a.body);this.endExcept();this._jump(f);for(d=0;d<b;++d){this.setBlock(c[d]);var h=a.handlers[d];if(!h.type&&d<b-1)throw new SyntaxError("default 'except:' must be last");if(h.type){var k=this.vexpr(h.type),l=d==b-1?e:c[d+1],k=this._gr("instance","$err instanceof ",
k);this._jumpfalse(k,l)}h.name&&this.vexpr(h.name,"$err");this.vseqstmt(h.body);this._jump(g)}this.setBlock(e);out("throw $err;");this.setBlock(f);this.vseqstmt(a.orelse);this._jump(g);this.setBlock(g)};Compiler.prototype.ctryfinally=function(a){out("/*todo; tryfinally*/");this.ctryexcept(a.body[0])};Compiler.prototype.cassert=function(a){var b=this.vexpr(a.test),c=this.newBlock("end");this._jumptrue(b,c);out("throw new Sk.builtin.AssertionError(",a.msg?this.vexpr(a.msg):"",");");this.setBlock(c)};
Compiler.prototype.cimportas=function(a,b,c){a=a.v;var d=a.indexOf(".");if(-1!==d)for(a=a.substr(d+1);-1!==d;){var d=a.indexOf("."),e=-1!==d?a.substr(0,d):a;c=this._gr("lattr","Sk.abstr.gattr(",c,",'",e,"')");a=a.substr(d+1)}return this.nameop(b,Store,c)};
Compiler.prototype.cimport=function(a){for(var b=a.names.length,c=0;c<b;++c){var d=a.names[c],e=this._gr("module","Sk.builtin.__import__(",d.name.$r().v,",$gbl,$loc,[])");if(d.asname)this.cimportas(d.name,d.asname,e);else{var d=d.name,f=d.v.indexOf(".");-1!==f&&(d=new Sk.builtin.str(d.v.substr(0,f)));this.nameop(d,Store,e)}}};
Compiler.prototype.cfromimport=function(a){for(var b=a.names.length,c=[],d=0;d<b;++d)c[d]=a.names[d].name.$r().v;c=this._gr("module","Sk.builtin.__import__(",a.module.$r().v,",$gbl,$loc,[",c,"])");for(d=0;d<b;++d){var e=a.names[d];if(0===d&&"*"===e.name.v){goog.asserts.assert(1===b);out("Sk.importStar(",c,",$loc, $gbl);");break}var f=this._gr("item","Sk.abstr.gattr(",c,",",e.name.$r().v,")"),g=e.name;e.asname&&(g=e.asname);this.nameop(g,Store,f)}};
Compiler.prototype.buildcodeobj=function(a,b,c,d,e){var f=[],g=null,h=null;c&&this.vseqexpr(c);d&&d.defaults&&(f=this.vseqexpr(d.defaults));d&&d.vararg&&(g=d.vararg);d&&d.kwarg&&(h=d.kwarg);a=this.enterScope(b,a,a.lineno);c=this.u.ste.generator;var k=this.u.ste.hasFree,l=this.u.ste.childHasFree,m=this.newBlock("codeobj entry");this.u.prefixCode="var "+a+"=(function "+this.niceName(b.v)+"$(";var n=[];if(c){if(h)throw new SyntaxError(b.v+"(): keyword arguments in generators not supported");if(g)throw new SyntaxError(b.v+
"(): variable number of arguments in generators not supported");n.push("$gen")}else{h&&n.push("$kwa");for(var p=0;d&&p<d.args.length;++p)n.push(this.nameop(d.args[p].id,Param))}k&&n.push("$free");this.u.prefixCode+=n.join(",");this.u.prefixCode+="){";c&&(this.u.prefixCode+="\n// generator\n");k&&(this.u.prefixCode+="\n// has free\n");l&&(this.u.prefixCode+="\n// has cell\n");p="{}";c&&(m="$gen.gi$resumeat",p="$gen.gi$locals");var q="";l&&(q=",$cell={}");this.u.varDeclsCode+="var $blk="+m+",$exc=[],$loc="+
p+q+",$gbl=this,$err=undefined;";for(p=0;d&&p<d.args.length;++p)l=d.args[p].id,this.isCell(l)&&(this.u.varDeclsCode+="$cell."+l.v+"="+l.v+";");c||(this.u.varDeclsCode+='Sk.builtin.pyCheckArgs("'+b.v+'", arguments, '+(d?d.args.length-f.length:0)+", "+(g?Infinity:d?d.args.length:0)+", "+(h?!0:!1)+", "+k+");");if(0<f.length)for(l=d.args.length-f.length,p=0;p<f.length;++p)m=this.nameop(d.args[p+l].id,Param),this.u.varDeclsCode+="if("+m+"===undefined)"+m+"="+a+".$defaults["+p+"];";g&&(this.u.varDeclsCode+=
g.v+"=new Sk.builtins['tuple'](Array.prototype.slice.call(arguments,"+n.length+")); /*vararg*/");h&&(this.u.varDeclsCode+=h.v+"=new Sk.builtins['dict']($kwa);");this.u.switchCode="while(true){try{ switch($blk){";this.u.suffixCode="} }catch(err){if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} }});";e.call(this,a);var r;if(d&&0<d.args.length){e=[];for(p=0;p<d.args.length;++p)e.push(d.args[p].id.v);r=e.join("', '");this.u.argnames=e}this.exitScope();0<f.length&&out(a,
".$defaults=[",f.join(","),"];");r&&out(a,".co_varnames=['",r,"'];");h&&out(a,".co_kwargs=1;");h="";k&&(h=",$cell",this.u.ste.hasFree&&(h+=",$free"));return c?d&&0<d.args.length?this._gr("gener",'(function(){var $origargs=Array.prototype.slice.call(arguments);Sk.builtin.pyCheckArgs("',b.v,'",arguments,',d.args.length-f.length,",",d.args.length,");return new Sk.builtins['generator'](",a,",$gbl,$origargs",h,");})"):this._gr("gener",'(function(){Sk.builtin.pyCheckArgs("',b.v,"\",arguments,0,0);return new Sk.builtins['generator'](",
a,",$gbl,[]",h,");})"):this._gr("funcobj","new Sk.builtins['function'](",a,",$gbl",h,")")};Compiler.prototype.cfunction=function(a){goog.asserts.assert(a instanceof FunctionDef);var b=this.buildcodeobj(a,a.name,a.decorator_list,a.args,function(b){this.vseqstmt(a.body);out("return Sk.builtin.none.none$;")});this.nameop(a.name,Store,b)};
Compiler.prototype.clambda=function(a){goog.asserts.assert(a instanceof Lambda);return this.buildcodeobj(a,new Sk.builtin.str("<lambda>"),null,a.args,function(b){b=this.vexpr(a.body);out("return ",b,";")})};
Compiler.prototype.cifexp=function(a){var b=this.newBlock("next of ifexp"),c=this.newBlock("end of ifexp"),d=this._gr("res","null"),e=this.vexpr(a.test);this._jumpfalse(e,b);out(d,"=",this.vexpr(a.body),";");this._jump(c);this.setBlock(b);out(d,"=",this.vexpr(a.orelse),";");this._jump(c);this.setBlock(c);return d};
Compiler.prototype.cgenexpgen=function(a,b,c){var d=this.newBlock("start for "+b),e=this.newBlock("skip for "+b);this.newBlock("if cleanup for "+b);var f=this.newBlock("end for "+b),g=a[b],h;if(0===b)h="$loc.$iter0";else{var k=this.vexpr(g.iter);h="$loc."+this.gensym("iter");out(h,"=","Sk.abstr.iter(",k,");")}this._jump(d);this.setBlock(d);h=this._gr("next","Sk.abstr.iternext(",h,")");this._jumpundef(h,f);this.vexpr(g.target,h);h=g.ifs.length;for(k=0;k<h;++k){var l=this.vexpr(g.ifs[k]);this._jumpfalse(l,
d)}++b<a.length&&this.cgenexpgen(a,b,c);b>=a.length&&(a=this.vexpr(c),out("return [",e,"/*resume*/,",a,"/*ret*/];"),this.setBlock(e));this._jump(d);this.setBlock(f);1===b&&out("return null;")};Compiler.prototype.cgenexp=function(a){var b=this.buildcodeobj(a,new Sk.builtin.str("<genexpr>"),null,null,function(b){this.cgenexpgen(a.generators,0,a.elt)}),b=this._gr("gener",b,"()");out(b,".gi$locals.$iter0=Sk.abstr.iter(",this.vexpr(a.generators[0].iter),");");return b};
Compiler.prototype.cclass=function(a){goog.asserts.assert(a instanceof ClassDef);var b=this.vseqexpr(a.bases),c=this.enterScope(a.name,a,a.lineno),d=this.newBlock("class entry");this.u.prefixCode="var "+c+"=(function $"+a.name.v+"$class_outer($globals,$locals,$rest){var $gbl=$globals,$loc=$locals;";this.u.switchCode+="return(function "+a.name.v+"(){";this.u.switchCode+="var $blk="+d+",$exc=[];while(true){switch($blk){";this.u.suffixCode="}break;}}).apply(null,$rest);});";this.u.private_=a.name;this.cbody(a.body);
out("break;");this.exitScope();b=this._gr("built","Sk.misceval.buildClass($gbl,",c,",",a.name.$r().v,",[",b,"])");this.nameop(a.name,Store,b)};Compiler.prototype.ccontinue=function(a){if(0===this.u.continueBlocks.length)throw new SyntaxError("'continue' outside loop");this._jump(this.u.continueBlocks[this.u.continueBlocks.length-1])};
Compiler.prototype.vstmt=function(a){this.u.lineno=a.lineno;this.u.linenoSet=!1;this.annotateSource(a);switch(a.constructor){case FunctionDef:this.cfunction(a);break;case ClassDef:this.cclass(a);break;case Return_:if(this.u.ste.blockType!==FunctionBlock)throw new SyntaxError("'return' outside function");a.value?out("return ",this.vexpr(a.value),";"):out("return null;");break;case Delete_:this.vseqexpr(a.targets);break;case Assign:for(var b=a.targets.length,c=this.vexpr(a.value),d=0;d<b;++d)this.vexpr(a.targets[d],
c);break;case AugAssign:return this.caugassign(a);case Print:this.cprint(a);break;case For_:return this.cfor(a);case While_:return this.cwhile(a);case If_:return this.cif(a);case Raise:return this.craise(a);case TryExcept:return this.ctryexcept(a);case TryFinally:return this.ctryfinally(a);case Assert:return this.cassert(a);case Import_:return this.cimport(a);case ImportFrom:return this.cfromimport(a);case Global:break;case Expr:this.vexpr(a.value);break;case Pass:break;case Break_:if(0===this.u.breakBlocks.length)throw new SyntaxError("'break' outside loop");
this._jump(this.u.breakBlocks[this.u.breakBlocks.length-1]);break;case Continue_:this.ccontinue(a);break;default:goog.asserts.fail("unhandled case in vstmt")}};Compiler.prototype.vseqstmt=function(a){for(var b=0;b<a.length;++b)this.vstmt(a[b])};var OP_FAST=0,OP_GLOBAL=1,OP_DEREF=2,OP_NAME=3,D_NAMES=0,D_FREEVARS=1,D_CELLVARS=2;Compiler.prototype.isCell=function(a){a=mangleName(this.u.private_,a).v;return this.u.ste.getScope(a)===CELL?!0:!1};
Compiler.prototype.nameop=function(a,b,c){if((b===Store||b===AugStore||b===Del)&&"__debug__"===a.v)throw new Sk.builtin.SyntaxError("can not assign to __debug__");if((b===Store||b===AugStore||b===Del)&&"None"===a.v)throw new Sk.builtin.SyntaxError("can not assign to None");if("None"===a.v)return"Sk.builtin.none.none$";if("True"===a.v)return"Sk.builtin.bool.true$";if("False"===a.v)return"Sk.builtin.bool.false$";var d=mangleName(this.u.private_,a).v,d=fixReservedNames(d),e=OP_NAME,f=this.u.ste.getScope(d),
g=null;switch(f){case FREE:g="$free";e=OP_DEREF;break;case CELL:g="$cell";e=OP_DEREF;break;case LOCAL:this.u.ste.blockType!==FunctionBlock||this.u.ste.generator||(e=OP_FAST);break;case GLOBAL_IMPLICIT:this.u.ste.blockType===FunctionBlock&&(e=OP_GLOBAL);break;case GLOBAL_EXPLICIT:e=OP_GLOBAL}d=fixReservedWords(d);goog.asserts.assert(f||"_"===a.v.charAt(1));a=d;this.u.ste.generator||this.u.ste.blockType!==FunctionBlock?d="$loc."+d:e!==OP_FAST&&e!==OP_NAME||this.u.localnames.push(d);switch(e){case OP_FAST:switch(b){case Load:case Param:return out("if (",
d," === undefined) { throw new Error('local variable \\'",d,"\\' referenced before assignment'); }\n"),d;case Store:out(d,"=",c,";");break;case Del:out("delete ",d,";");break;default:goog.asserts.fail("unhandled")}break;case OP_NAME:switch(b){case Load:return b=this.gensym("loadname"),out("var ",b,"=",d,"!==undefined?",d,":Sk.misceval.loadname('",a,"',$gbl);"),b;case Store:out(d,"=",c,";");break;case Del:out("delete ",d,";");break;case Param:return d;default:goog.asserts.fail("unhandled")}break;case OP_GLOBAL:switch(b){case Load:return this._gr("loadgbl",
"Sk.misceval.loadname('",a,"',$gbl)");case Store:out("$gbl.",a,"=",c,";");break;case Del:out("delete $gbl.",a);break;default:goog.asserts.fail("unhandled case in name op_global")}break;case OP_DEREF:switch(b){case Load:return g+"."+a;case Store:out(g,".",a,"=",c,";");break;case Param:return a;default:goog.asserts.fail("unhandled case in name op_deref")}break;default:goog.asserts.fail("unhandled case")}};
Compiler.prototype.enterScope=function(a,b,c){var d=new CompilerUnit;d.ste=this.st.getStsForAst(b);d.name=a;d.firstlineno=c;this.u&&this.u.private_&&(d.private_=this.u.private_);this.stack.push(this.u);this.allUnits.push(d);a=this.gensym("scope");d.scopename=a;this.u=d;this.u.activateScope();this.nestlevel++;return a};
Compiler.prototype.exitScope=function(){var a=this.u;this.nestlevel--;(this.u=0<=this.stack.length-1?this.stack.pop():null)&&this.u.activateScope();if("<module>"!==a.name.v){var b=a.name.$r().v,b=b.substring(1,b.length-1),b=fixReservedWords(b),b=fixReservedNames(b);out(a.scopename,".co_name=new Sk.builtins['str']('",b,"');")}};Compiler.prototype.cbody=function(a){for(var b=0;b<a.length;++b)this.vstmt(a[b])};
Compiler.prototype.cprint=function(a){goog.asserts.assert(a instanceof Print);a.dest&&this.vexpr(a.dest);for(var b=a.values.length,c=0;c<b;++c)out("Sk.misceval.print_(","new Sk.builtins['str'](",this.vexpr(a.values[c]),").v);");a.nl&&out("Sk.misceval.print_(",'"\\n");')};
Compiler.prototype.cmod=function(a){var b=this.enterScope(new Sk.builtin.str("<module>"),a,0),c=this.newBlock("module entry");this.u.prefixCode="var "+b+"=(function($modname){";this.u.varDeclsCode="var $blk="+c+",$exc=[],$gbl={},$loc=$gbl,$err=undefined;$gbl.__name__=$modname;Sk.globals=$gbl;";this.u.switchCode="try { while(true){try{ switch($blk){";this.u.suffixCode="} }catch(err){if ($exc.length>0) { $err = err; $blk=$exc.pop(); continue; } else { throw err; }} } }catch(err){ if (err instanceof Sk.builtin.SystemExit && !Sk.throwSystemExit) { Sk.misceval.print_(err.toString() + '\\n'); return $loc; } else { throw err; } } });";
switch(a.constructor){case Module:this.cbody(a.body);out("return $loc;");break;default:goog.asserts.fail("todo; unhandled case in compilerMod")}this.exitScope();this.result.push(this.outputAllUnits());return b};Sk.compile=function(a,b,c){c=Sk.parse(b,a);c=Sk.astFromParse(c,b);var d=Sk.symboltable(c,b);a=new Compiler(b,d,0,a);b=a.cmod(c);a=a.result.join("");return{funcname:b,code:a}};goog.exportSymbol("Sk.compile",Sk.compile);Sk.resetCompiler=function(){Sk.gensymcount=0};
goog.exportSymbol("Sk.resetCompiler",Sk.resetCompiler);Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.importSearchPathForName=function(a,b,c){for(var d=Sk.realsyspath.tp$iter(),e=d.tp$iternext();void 0!==e;e=d.tp$iternext())for(var f=a.replace(/\./g,"/"),e=[e.v+"/"+f+b,e.v+"/"+f+"/__init__"+b],f=0;f<e.length;++f){var g=e[f];try{return Sk.read(g),g}catch(h){}}if(!c)throw new Sk.builtin.ImportError("No module named "+a);};
Sk.doOneTimeInitialization=function(){Sk.builtin.type.basesStr_=new Sk.builtin.str("__bases__");Sk.builtin.type.mroStr_=new Sk.builtin.str("__mro__");Sk.builtin.object.$d=new Sk.builtin.dict([]);Sk.builtin.object.$d.mp$ass_subscript(Sk.builtin.type.basesStr_,new Sk.builtin.tuple([]));Sk.builtin.object.$d.mp$ass_subscript(Sk.builtin.type.mroStr_,new Sk.builtin.tuple([Sk.builtin.object]))};
Sk.importSetUpPath=function(){if(!Sk.realsyspath){for(var a=[new Sk.builtin.str("src/builtin"),new Sk.builtin.str("src/lib"),new Sk.builtin.str(".")],b=0;b<Sk.syspath.length;++b)a.push(new Sk.builtin.str(Sk.syspath[b]));Sk.realsyspath=new Sk.builtin.list(a);Sk.doOneTimeInitialization()}};if(COMPILED)var js_beautify=function(a){return a};
Sk.importModuleInternal_=function(a,b,c,d){Sk.importSetUpPath();void 0===c&&(c=a);var e=null,f=c.split("."),g;try{var h=Sk.sysmodules.mp$subscript(c);return 1<f.length?Sk.sysmodules.mp$subscript(f[0]):h}catch(k){}1<f.length&&(g=f.slice(0,f.length-1).join("."),e=Sk.importModuleInternal_(g,b));h=new Sk.builtin.module;Sk.sysmodules.mp$ass_subscript(a,h);d?a=Sk.compile(d,a+".py","exec"):(d=Sk.importSearchPathForName(a,".js",!0))?a={funcname:"$builtinmodule",code:Sk.read(d)}:(a=Sk.importSearchPathForName(a,
".py"),a=Sk.compile(Sk.read(a),a,"exec"));d=h.$js=a.code;null!=Sk.dateSet&&Sk.dateSet||(d="Sk.execStart = new Date();\n"+a.code,Sk.dateSet=!0);if(b){b=js_beautify(a.code).split("\n");for(d=1;d<=b.length;++d){for(var l="",m=(""+d).length;5>m;++m)l+=" ";b[d-1]="/* "+l+d+" */ "+b[d-1]}d=b.join("\n");Sk.debugout(d)}d+="\n"+a.funcname+"("+("new Sk.builtin.str('"+c+"')")+");";b=goog.global.eval(d);b.__name__||(b.__name__=new Sk.builtin.str(c));h.$d=b;return e?(Sk.sysmodules.mp$subscript(g).tp$setattr(f[f.length-
1],h),e):h};Sk.importModule=function(a,b){return Sk.importModuleInternal_(a,b)};Sk.importMain=function(a,b){Sk.dateSet=!1;Sk.filesLoaded=!1;Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.resetCompiler();return Sk.importModuleInternal_(a,b,"__main__")};Sk.importMainWithBody=function(a,b,c){Sk.dateSet=!1;Sk.filesLoaded=!1;Sk.sysmodules=new Sk.builtin.dict([]);Sk.realsyspath=void 0;Sk.resetCompiler();return Sk.importModuleInternal_(a,b,"__main__",c)};
Sk.builtin.__import__=function(a,b,c,d){b=Sk.importModuleInternal_(a);if(!d||0===d.length)return b;b=Sk.sysmodules.mp$subscript(a);goog.asserts.assert(b);return b};Sk.importStar=function(a,b){var c=Object.getOwnPropertyNames(a.$d),d;for(d in c)b[c[d]]=a.$d[c[d]]};goog.exportSymbol("Sk.importMain",Sk.importMain);goog.exportSymbol("Sk.importMainWithBody",Sk.importMainWithBody);goog.exportSymbol("Sk.builtin.__import__",Sk.builtin.__import__);goog.exportSymbol("Sk.importStar",Sk.importStar);Sk.builtin.timSort=function(a,b){this.list=new Sk.builtin.list(a.v);this.MIN_GALLOP=7;this.listlength=b?b:a.sq$length()};Sk.builtin.timSort.prototype.lt=function(a,b){return Sk.misceval.richCompareBool(a,b,"Lt")};Sk.builtin.timSort.prototype.le=function(a,b){return!this.lt(b,a)};Sk.builtin.timSort.prototype.setitem=function(a,b){this.list.v[a]=b};
Sk.builtin.timSort.prototype.binary_sort=function(a,b){for(var c=a.base+b;c<a.base+a.len;c++){for(var d=a.base,e=c,f=a.getitem(e);d<e;){var g=d+(e-d>>1);this.lt(f,a.getitem(g))?e=g:d=g+1}goog.asserts.assert(d===e);for(g=c;g>d;g--)a.setitem(g,a.getitem(g-1));a.setitem(d,f)}};
Sk.builtin.timSort.prototype.count_run=function(a){var b;if(1>=a.len){var c=a.len;b=!1}else if(c=2,this.lt(a.getitem(a.base+1),a.getitem(a.base))){b=!0;for(var d=a.base+2;d<a.base+a.len;d++)if(this.lt(a.getitem(d),a.getitem(d-1)))c++;else break}else for(b=!1,d=a.base+2;d<a.base+a.len&&!this.lt(a.getitem(d),a.getitem(d-1));d++)c++;return{run:new Sk.builtin.listSlice(a.list,a.base,c),descending:b}};
Sk.builtin.timSort.prototype.sort=function(){var a=new Sk.builtin.listSlice(this.list,0,this.listlength);if(!(2>a.len)){this.merge_init();for(var b=this.merge_compute_minrun(a.len);0<a.len;){var c=this.count_run(a);c.descending&&c.run.reverse();if(c.run.len<b){var d=c.run.len;c.run.len=b<a.len?b:a.len;this.binary_sort(c.run,d)}a.advance(c.run.len);this.pending.push(c.run);this.merge_collapse()}goog.asserts.assert(a.base==this.listlength);this.merge_force_collapse();goog.asserts.assert(1==this.pending.length);
goog.asserts.assert(0==this.pending[0].base);goog.asserts.assert(this.pending[0].len==this.listlength)}};
Sk.builtin.timSort.prototype.gallop=function(a,b,c,d){goog.asserts.assert(0<=c&&c<b.len);var e=this;d=d?function(a,b){return e.le(a,b)}:function(a,b){return e.lt(a,b)};var f=b.base+c,g=0,h=1,k;if(d(b.getitem(f),a)){for(k=b.len-c;h<k;)if(d(b.getitem(f+h),a)){g=h;try{h=(h<<1)+1}catch(l){h=k}}else break;h>k&&(h=k);g+=c;h+=c}else{for(k=c+1;h<k&&!d(b.getitem(f-h),a);){g=h;try{h=(h<<1)+1}catch(m){h=k}}h>k&&(h=k);f=c-g;g=c-h;h=f}goog.asserts.assert(-1<=g<h<=b.len);for(g+=1;g<h;)c=g+(h-g>>1),d(b.getitem(b.base+
c),a)?g=c+1:h=c;goog.asserts.assert(g==h);return h};Sk.builtin.timSort.prototype.merge_init=function(){this.min_gallop=this.MIN_GALLOP;this.pending=[]};
Sk.builtin.timSort.prototype.merge_lo=function(a,b){goog.asserts.assert(0<a.len&&0<b.len&&a.base+a.len==b.base);var c=this.min_gallop,d=a.base;a=a.copyitems();try{if(this.setitem(d,b.popleft()),d++,1!=a.len&&0!=b.len)for(var e,f;;){for(f=e=0;;)if(this.lt(b.getitem(b.base),a.getitem(a.base))){this.setitem(d,b.popleft());d++;if(0==b.len)return;f++;e=0;if(f>=c)break}else{this.setitem(d,a.popleft());d++;if(1==a.len)return;e++;f=0;if(e>=c)break}for(c+=1;;){this.min_gallop=c-=1<c;e=this.gallop(b.getitem(b.base),
a,0,!0);for(var g=a.base;g<a.base+e;g++)this.setitem(d,a.getitem(g)),d++;a.advance(e);if(1>=a.len)return;this.setitem(d,b.popleft());d++;if(0==b.len)return;f=this.gallop(a.getitem(a.base),b,0,!1);for(g=b.base;g<b.base+f;g++)this.setitem(d,b.getitem(g)),d++;b.advance(f);if(0==b.len)return;this.setitem(d,a.popleft());d++;if(1==a.len)return;if(e<this.MIN_GALLOP&&f<this.MIN_GALLOP)break;c++;this.min_gallop=c}}}finally{goog.asserts.assert(0<=a.len&&0<=b.len);for(g=b.base;g<b.base+b.len;g++)this.setitem(d,
b.getitem(g)),d++;for(g=a.base;g<a.base+a.len;g++)this.setitem(d,a.getitem(g)),d++}};
Sk.builtin.timSort.prototype.merge_hi=function(a,b){goog.asserts.assert(0<a.len&&0<b.len&&a.base+a.len==b.base);var c=this.min_gallop,d=b.base+b.len;b=b.copyitems();try{if(d--,this.setitem(d,a.popright()),0!=a.len&&1!=b.len)for(var e,f,g,h;;){for(f=e=0;;)if(g=a.getitem(a.base+a.len-1),h=b.getitem(b.base+b.len-1),this.lt(h,g)){d--;this.setitem(d,g);a.len--;if(0==a.len)return;e++;f=0;if(e>=c)break}else{d--;this.setitem(d,h);b.len--;if(1==b.len)return;f++;e=0;if(f>=c)break}for(c+=1;;){this.min_gallop=
c-=1<c;h=b.getitem(b.base+b.len-1);var k=this.gallop(h,a,a.len-1,!0);e=a.len-k;for(var l=a.base+a.len-1;l>a.base+k-1;l--)d--,this.setitem(d,a.getitem(l));a.len-=e;if(0==a.len)return;d--;this.setitem(d,b.popright());if(1==b.len)return;g=a.getitem(a.base+a.len-1);k=this.gallop(g,b,b.len-1,!1);f=b.len-k;for(l=b.base+b.len-1;l>b.base+k-1;l--)d--,this.setitem(d,b.getitem(l));b.len-=f;if(1>=b.len)return;d--;this.setitem(d,a.popright());if(0==a.len)return;if(e<this.MIN_GALLOP&&f<this.MIN_GALLOP)break;c++;
this.min_gallop=c}}}finally{goog.asserts.assert(0<=a.len&&0<=b.len);for(l=a.base+a.len-1;l>a.base-1;l--)d--,this.setitem(d,a.getitem(l));for(l=b.base+b.len-1;l>b.base-1;l--)d--,this.setitem(d,b.getitem(l))}};
Sk.builtin.timSort.prototype.merge_at=function(a){0>a&&(a=this.pending.length+a);var b=this.pending[a],c=this.pending[a+1];goog.asserts.assert(0<b.len&&0<c.len);goog.asserts.assert(b.base+b.len==c.base);this.pending[a]=new Sk.builtin.listSlice(this.list,b.base,b.len+c.len);this.pending.splice(a+1,1);a=this.gallop(c.getitem(c.base),b,0,!0);b.advance(a);0!=b.len&&(c.len=this.gallop(b.getitem(b.base+b.len-1),c,c.len-1,!1),0!=c.len&&(b.len<=c.len?this.merge_lo(b,c):this.merge_hi(b,c)))};
Sk.builtin.timSort.prototype.merge_collapse=function(){for(var a=this.pending;1<a.length;)if(3<=a.length&&a[a.length-3].len<=a[a.length-2].len+a[a.length-1].len)a[a.length-3].len<a[a.length-1].len?this.merge_at(-3):this.merge_at(-2);else if(a[a.length-2].len<=a[a.length-1].len)this.merge_at(-2);else break};Sk.builtin.timSort.prototype.merge_force_collapse=function(){for(var a=this.pending;1<a.length;)3<=a.length&&a[a.length-3].len<a[a.length-1].len?this.merge_at(-3):this.merge_at(-2)};
Sk.builtin.timSort.prototype.merge_compute_minrun=function(a){for(var b=0;64<=a;)b|=a&1,a>>=1;return a+b};Sk.builtin.listSlice=function(a,b,c){this.list=a;this.base=b;this.len=c};Sk.builtin.listSlice.prototype.copyitems=function(){var a=this.base,b=this.base+this.len;goog.asserts.assert(0<=a<=b);return new Sk.builtin.listSlice(new Sk.builtin.list(this.list.v.slice(a,b)),0,this.len)};Sk.builtin.listSlice.prototype.advance=function(a){this.base+=a;this.len-=a;goog.asserts.assert(this.base<=this.list.sq$length())};
Sk.builtin.listSlice.prototype.getitem=function(a){return this.list.v[a]};Sk.builtin.listSlice.prototype.setitem=function(a,b){this.list.v[a]=b};Sk.builtin.listSlice.prototype.popleft=function(){var a=this.list.v[this.base];this.base++;this.len--;return a};Sk.builtin.listSlice.prototype.popright=function(){this.len--;return this.list.v[this.base+this.len]};
Sk.builtin.listSlice.prototype.reverse=function(){for(var a=this.list,b=this.base,c=b+this.len-1;b<c;){var d=a.v[b];a.v[b]=a.v[c];a.v[c]=d;b++;c--}};goog.exportSymbol("Sk.builtin.listSlice",Sk.builtin.listSlice);goog.exportSymbol("Sk.builtin.timSort",Sk.builtin.timSort);Sk.builtins={range:Sk.builtin.range,round:Sk.builtin.round,len:Sk.builtin.len,min:Sk.builtin.min,max:Sk.builtin.max,sum:Sk.builtin.sum,zip:Sk.builtin.zip,abs:Sk.builtin.abs,fabs:Sk.builtin.abs,ord:Sk.builtin.ord,chr:Sk.builtin.chr,hex:Sk.builtin.hex,oct:Sk.builtin.oct,bin:Sk.builtin.bin,dir:Sk.builtin.dir,repr:Sk.builtin.repr,open:Sk.builtin.open,isinstance:Sk.builtin.isinstance,hash:Sk.builtin.hash,getattr:Sk.builtin.getattr,float_$rw$:Sk.builtin.float_,int_$rw$:Sk.builtin.int_,hasattr:Sk.builtin.hasattr,
map:Sk.builtin.map,filter:Sk.builtin.filter,reduce:Sk.builtin.reduce,sorted:Sk.builtin.sorted,bool:Sk.builtin.bool,any:Sk.builtin.any,all:Sk.builtin.all,enumerate:Sk.builtin.enumerate,AttributeError:Sk.builtin.AttributeError,ValueError:Sk.builtin.ValueError,Exception:Sk.builtin.Exception,ZeroDivisionError:Sk.builtin.ZeroDivisionError,AssertionError:Sk.builtin.AssertionError,ImportError:Sk.builtin.ImportError,IndentationError:Sk.builtin.IndentationError,IndexError:Sk.builtin.IndexError,KeyError:Sk.builtin.KeyError,
TypeError:Sk.builtin.TypeError,NameError:Sk.builtin.NameError,IOError:Sk.builtin.IOError,NotImplementedError:Sk.builtin.NotImplementedError,SystemExit:Sk.builtin.SystemExit,OverflowError:Sk.builtin.OverflowError,OperationError:Sk.builtin.OperationError,dict:Sk.builtin.dict,file:Sk.builtin.file,"function":Sk.builtin.func,generator:Sk.builtin.generator,list:Sk.builtin.list,long_$rw$:Sk.builtin.lng,method:Sk.builtin.method,object:Sk.builtin.object,slice:Sk.builtin.slice,str:Sk.builtin.str,set:Sk.builtin.set,
tuple:Sk.builtin.tuple,type:Sk.builtin.type,input:Sk.builtin.input,raw_input:Sk.builtin.raw_input,jseval:Sk.builtin.jseval,jsmillis:Sk.builtin.jsmillis,quit:Sk.builtin.quit,exit:Sk.builtin.quit,bytearray:Sk.builtin.bytearray,callable:Sk.builtin.callable,complex:Sk.builtin.complex,delattr:Sk.builtin.delattr,divmod:Sk.builtin.divmod,eval_$rn$:Sk.builtin.eval_,execfile:Sk.builtin.execfile,format:Sk.builtin.format,frozenset:Sk.builtin.frozenset,globals:Sk.builtin.globals,help:Sk.builtin.help,issubclass:Sk.builtin.issubclass,
iter:Sk.builtin.iter,locals:Sk.builtin.locals,memoryview:Sk.builtin.memoryview,next:Sk.builtin.next_,pow:Sk.builtin.pow,property:Sk.builtin.property,reload:Sk.builtin.reload,reversed:Sk.builtin.reversed,"super":Sk.builtin.superbi,unichr:Sk.builtin.unichr,vars:Sk.builtin.vars,xrange:Sk.builtin.xrange,apply_$rn$:Sk.builtin.apply_,buffer:Sk.builtin.buffer,coerce:Sk.builtin.coerce,intern:Sk.builtin.intern};goog.exportSymbol("Sk.builtins",Sk.builtins);}());

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

@ -0,0 +1,468 @@
var elem; // current audio element playing
var currIndex; // current index
var len; // current length of audio files for tour
var buttonCount; // number of audio tour buttons
var aname; // the audio file name
var ahash; // hash of the audio file name to the lines to highlight
var theDivid; // div id
var afile; // file name for audio
var playing = false; // flag to say if playing or not
var tourName;
String.prototype.replaceAll = function (target, replacement) {
return this.split(target).join(replacement);
};
// function to display the audio tours
var createAudioTourHTML = function (divid, code, bnum, audio_text) {
// Replacing has been done here to make sure special characters in the code are displayed correctly
code = code.replaceAll("*doubleq*", "\"");
code = code.replaceAll("*singleq*", "'");
code = code.replaceAll("*open*", "(");
code = code.replaceAll("*close*", ")");
code = code.replaceAll("*nline*", "<br/>");
var codeArray = code.split("<br/>");
var audio_hash = new Array();
var bval = new Array();
var atype = audio_text.replaceAll("*doubleq*", "\"");
var audio_type = atype.split("*atype*");
for (var i = 0; i < audio_type.length - 1; i++) {
audio_hash[i] = audio_type[i];
var aword = audio_type[i].split(";");
bval.push(aword[0]);
}
var first = "<pre><div id='" + divid + "_l1'>" + "1. " + codeArray[0] + "</div>";
num_lines = codeArray.length;
for (var i = 1; i < num_lines; i++) {
var sec = "<div id='" + divid + "_l" + (i + 1) + "'>" + (i + 1) + ". " + codeArray[i] + "</div>";
var next = first.concat(sec);
first = next;
}
first = first + "</pre>"
//laying out the HTML content
var bcount = 0;
var html_string = "<div class='modal-lightsout'></div><div class='modal-profile'><h3>Take an audio tour!</h3><div class='modal-close-profile'></div><p id='windowcode'></p><p id='" + divid + "_audiocode'></p>";
html_string += "<p id='status'></p>";
html_string += "<input type='image' src='../_static/first.png' width='25' id='first_audio' name='first_audio' title='Play first audio in tour' alt='Play first audio in tour' disabled/>" + "<input type='image' src='../_static/prev.png' width='25' id='prev_audio' name='prev_audio' title='Play previous audio in tour' alt='Play previous audio in tour' disabled/>" + "<input type='image' src='../_static/pause.png' width='25' id='pause_audio' name='pause_audio' title='Pause current audio' alt='Pause current audio' disabled/><input type='image' src='../_static/next.png' width ='25' id='next_audio' name='next_audio' title='Play next audio in tour' alt='Play next audio in tour' disabled/><input type='image' src='../_static/last.png' width ='25' id='last_audio' name='last_audio' title='Play last audio in tour' alt='Play last audio in tour' disabled/><br/>";
for (var i = 0; i < audio_type.length - 1; i++) {
html_string += "<input type='button' style='margin-right:5px;' class='btn btn-default btn-sm' id='button_audio_" + i + "' name='button_audio_" + i + "' value=" + bval[i] + " />";
bcount++;
}
//html_string += "<p id='hightest'></p><p id='hightest1'></p><br/><br/><p id='test'></p><br/><p id='audi'></p></div>";
html_string += "</div>";
$('#cont').html(html_string);
$('#windowcode').html(first);
// Position modal box in the center of the page
$.fn.center = function () {
this.css("position", "absolute");
// y position
this.css("top", ($(window).scrollTop() + $(navbar).height() + 10 + "px"));
// show window on the left so that you can see the output from the code still
this.css("left", ($(window).scrollLeft() + "px"));
return this;
}
$(".modal-profile").center();
$('.modal-profile').fadeIn("slow");
//$('.modal-lightsout').css("height", $(document).height());
$('.modal-lightsout').fadeTo("slow", .5);
$('.modal-close-profile').show();
// closes modal box once close link is clicked, or if the lights out divis clicked
$('.modal-close-profile, .modal-lightsout').click(function () {
if (playing) {
elem.pause();
}
//log change to db
logBookEvent({'event': 'Audio', 'change': 'closeWindow', 'div_id': divid});
$('.modal-profile').fadeOut("slow");
$('.modal-lightsout').fadeOut("slow");
});
// Accommodate buttons for a maximum of five tours
$('#' + 'button_audio_0').click(function () {
tour(divid, audio_hash[0], bcount);
});
$('#' + 'button_audio_1').click(function () {
tour(divid, audio_hash[1], bcount);
});
$('#' + 'button_audio_2').click(function () {
tour(divid, audio_hash[2], bcount);
});
$('#' + 'button_audio_3').click(function () {
tour(divid, audio_hash[3], bcount);
});
$('#' + 'button_audio_4').click(function () {
tour(divid, audio_hash[4], bcount);
});
// handle the click to go to the next audio
$('#first_audio').click(function () {
firstAudio();
});
// handle the click to go to the next audio
$('#prev_audio').click(function () {
prevAudio();
});
// handle the click to pause or play the audio
$('#pause_audio').click(function () {
pauseAndPlayAudio();
});
// handle the click to go to the next audio
$('#next_audio').click(function () {
nextAudio();
});
// handle the click to go to the next audio
$('#last_audio').click(function () {
lastAudio();
});
// make the image buttons look disabled
$("#first_audio").css('opacity', 0.25);
$("#prev_audio").css('opacity', 0.25);
$("#pause_audio").css('opacity', 0.25);
$("#next_audio").css('opacity', 0.25);
$("#last_audio").css('opacity', 0.25);
};
var tour = function (divid, audio_type, bcount) {
// set globals
buttonCount = bcount;
theDivid = divid;
// enable prev, pause/play and next buttons and make visible
$('#first_audio').removeAttr('disabled');
$('#prev_audio').removeAttr('disabled');
$('#pause_audio').removeAttr('disabled');
$('#next_audio').removeAttr('disabled');
$('#last_audio').removeAttr('disabled');
$("#first_audio").css('opacity', 1.0);
$("#prev_audio").css('opacity', 1.0);
$("#pause_audio").css('opacity', 1.0);
$("#next_audio").css('opacity', 1.0);
$("#last_audio").css('opacity', 1.0);
// disable tour buttons
for (var i = 0; i < bcount; i++)
$('#button_audio_' + i).attr('disabled', 'disabled');
var atype = audio_type.split(";");
var name = atype[0].replaceAll("\"", " ");
tourName = name;
$('#status').html("Starting the " + name);
//log tour type to db
logBookEvent({'event': 'Audio', 'tour type': name, 'div_id': divid});
var max = atype.length;
var str = "";
ahash = new Array();
aname = new Array();
for (i = 1; i < max - 1; i++) {
var temp = atype[i].split(":");
var temp_line = temp[0];
var temp_aname = temp[1];
var akey = temp_aname.substring(1, temp_aname.length);
var lnums = temp_line.substring(1, temp_line.length);
//alert("akey:"+akey+"lnum:"+lnums);
// str+="<audio id="+akey+" preload='auto'><source src='http://ice-web.cc.gatech.edu/ce21/audio/"+
// akey+".mp3' type='audio/mpeg'><source src='http://ice-web.cc.gatech.edu/ce21/audio/"+akey+
// ".ogg' type='audio/ogg'>Your browser does not support the audio tag</audio>";
str += "<audio id=" + akey + " preload='auto' ><source src='../_static/audio/" + akey +
".wav' type='audio/wav'><source src='../_static/audio/" +
akey + ".mp3' type='audio/mpeg'><br />Your browser does not support the audio tag</audio>";
ahash[akey] = lnums;
aname.push(akey);
}
var ahtml = "#" + divid + "_audiocode";
$(ahtml).html(str); // set the html to the audio tags
len = aname.length; // set the number of audio file in the tour
// start at the first audio
currIndex = 0;
// play the first audio in the tour
playCurrIndexAudio();
};
function handlePlaying() {
// if playing audio pause it
if (playing) {
elem.pause();
// unbind current ended
$('#' + afile).unbind('ended');
// unhighlight the prev lines
unhighlightLines(theDivid, ahash[aname[currIndex]]);
}
}
var firstAudio = function () {
// if audio is playing handle it
handlePlaying();
//log change to db
logBookEvent({'event': 'Audio', 'change': 'first', 'div_id': theDivid});
// move to the first audio
currIndex = 0;
// start at the first audio
playCurrIndexAudio();
};
var prevAudio = function () {
// if there is a previous audio
if (currIndex > 0)
{
// if audio is playing handle it
handlePlaying();
//log change to db
logBookEvent({'event': 'Audio', 'change': 'prev', 'div_id': theDivid});
// move to previous to the current (but the current index has moved to the next)
currIndex = currIndex - 1;
// start at the prev audio
playCurrIndexAudio();
}
};
var nextAudio = function () {
// if audio is playing handle it
handlePlaying();
//log change to db
logBookEvent({'event': 'Audio', 'change': 'next', 'div_id': theDivid});
// if not at the end
if (currIndex < (len - 1))
{
// start at the next audio
currIndex = currIndex + 1;
playCurrIndexAudio();
}
else if (currIndex == (len - 1))
{
handleTourEnd();
}
};
var lastAudio = function () {
// if audio is playing handle it
handlePlaying();
//log change to db
logBookEvent({'event': 'Audio', 'change': 'last', 'div_id': theDivid});
// move to the last audio
currIndex = len - 1;
// start at last
playCurrIndexAudio();
};
// play the audio at the current index
var playCurrIndexAudio = function () {
// set playing to false
playing = false;
// play the current audio and highlight the lines
playaudio(currIndex, aname, theDivid, ahash);
};
// handle the end of the tour
var handleTourEnd = function() {
$('#status').html(" The " + tourName + " Ended");
// disable the prev, pause/play, and next buttons and make them more invisible
$('#first_audio').attr('disabled', 'disabled');
$('#prev_audio').attr('disabled', 'disabled');
$('#pause_audio').attr('disabled', 'disabled');
$('#next_audio').attr('disabled', 'disabled');
$('#last_audio').attr('disabled', 'disabled');
$("#first_audio").css('opacity', 0.25);
$("#prev_audio").css('opacity', 0.25);
$("#pause_audio").css('opacity', 0.25);
$("#next_audio").css('opacity', 0.25);
$("#last_audio").css('opacity', 0.25);
// enable the tour buttons
for (var j = 0; j < buttonCount; j++)
$('#button_audio_' + j).removeAttr('disabled');
}
// only call this one after the first time
var outerAudio = function () {
// unbind ended
$('#' + afile).unbind('ended');
// set playing to false
playing = false;
// unhighlight previous lines from the last audio
unhighlightLines(theDivid, ahash[aname[currIndex]]);
// increment the currIndex to point to the next one
currIndex++;
// if the end of the tour reset the buttons
if (currIndex == len) {
handleTourEnd();
}
// else not done yet so play the next audio
else {
// play the audio at the current index
playCurrIndexAudio();
}
};
// play the audio now that it is ready
var playWhenReady = function(afile,divid,ahash) {
// unbind current
$('#' + afile).unbind('canplaythrough');
//console.log("in playWhenReady " + elem.duration);
$('#status').html("Playing the " + tourName);
elem.currentTime = 0;
highlightLines(divid, ahash[afile]);
$('#' + afile).bind('ended',function() {
outerAudio();
});
playing = true;
elem.play();
};
// play the audio at the specified index i and set the duration and highlight the lines
var playaudio = function (i, aname, divid, ahash) {
afile = aname[i];
elem = document.getElementById(afile);
// if this isn't ready to play yet - no duration yet then wait
//console.log("in playaudio " + elem.duration);
if (isNaN(elem.duration) || elem.duration == 0)
{
// set the status
$('#status').html("Loading audio. Please wait.");
$('#' + afile).bind('canplaythrough',function() {
playWhenReady(afile,divid,ahash);
});
}
// otherwise it is ready so play it
else
playWhenReady(afile,divid,ahash);
};
// pause if playing and play if paused
var pauseAndPlayAudio = function () {
var btn = document.getElementById('pause_audio');
// if paused and clicked then continue from current
if (elem.paused) {
// calcualte the time left to play in milliseconds
counter = (elem.duration - elem.currentTime) * 1000;
elem.play(); // start the audio from current spot
document.getElementById("pause_audio").src = "../_static/pause.png";
document.getElementById("pause_audio").title = "Pause current audio";
//log change to db
logBookEvent({'event': 'Audio', 'change': 'play', 'div_id': theDivid});
}
// if audio was playing pause it
else if (playing) {
elem.pause(); // pause the audio
document.getElementById("pause_audio").src = "../_static/play.png";
document.getElementById("pause_audio").title = "Play paused audio";
//log change to db
logBookEvent({'event': 'Audio', 'change': 'pause', 'div_id': theDivid});
}
};
// process the lines
var processLines = function (divid, lnum, color) {
var comma = lnum.split(",");
if (comma.length > 1) {
for (i = 0; i < comma.length; i++) {
setBackroundForLines(divid, comma[i], color);
}
}
else {
setBackroundForLines(divid, lnum, color);
}
};
// unhighlight the lines - set the background back to transparent
var unhighlightLines = function (divid, lnum) {
processLines(divid, lnum, 'transparent');
};
// highlight the lines - set the background to a yellow color
var highlightLines = function (divid, lnum) {
processLines(divid, lnum, '#ffff99');
};
// set the background to the passed color
var setBackroundForLines = function (divid, lnum, color) {
var hyphen = lnum.split("-");
// if a range of lines
if (hyphen.length > 1) {
var start = parseInt(hyphen[0]);
var end = parseInt(hyphen[1]) + 1;
for (var k = start; k < end; k++) {
//alert(k);
var str = "#" + divid + "_l" + k;
if ($(str).text() != "")
$(str).css('background-color', color);
//$(str).effect("highlight",{},(dur*1000)+4500);
}
}
else {
//alert(lnum);
var str = "#" + divid + "_l" + lnum;
$(str).css('background-color', color);
//$(str).effect("highlight",{},(dur*1000)+4500);
}
};

View file

@ -0,0 +1,204 @@
Animator = function(m, v, divid)
{
this.model = m
this.viewer = v
this.timer = null
this.cursor = -1
this.sc = document.getElementById(divid+"_canvas")
this.ctx = this.sc.getContext("2d")
this.sc.width = this.sc.width
this.speed = 75
this.script = this.model.init() //does the animation and sends script back
this.viewer.init(this.ctx)
}
Animator.prototype.getContext=function()
{
return this.ctx
}
Animator.prototype.incCursor=function()
{
if (this.cursor < this.script.length-1)
this.cursor = this.cursor + 1
}
Animator.prototype.decCursor=function()
{
if (this.cursor > 0)
this.cursor = this.cursor -1
}
Animator.prototype.getCursor=function()
{
return this.cursor
}
Animator.prototype.setCursor=function(newc)
{
this.cursor = newc
}
Animator.prototype.run = function(animobj)
{
if (this.timer == null)
this.timer = setInterval(animobj+".forward()",this.speed)
}
Animator.prototype.stop = function()
{
clearInterval(this.timer)
this.timer=null
}
Animator.prototype.forward = function()
{
this.incCursor()
this.sc.width = this.sc.width
this.viewer.render(this.script[this.getCursor()])
if (this.getCursor() == this.script.length-1 && this.timer != null)
{
clearInterval(this.timer)
this.timer = null
}
}
Animator.prototype.backward = function()
{
this.decCursor()
this.sc.width = this.sc.width
this.viewer.render(this.script[this.getCursor()])
}
Animator.prototype.end = function()
{
this.setCursor(this.script.length-1)
this.sc.width = this.sc.width
this.viewer.render(this.script[this.getCursor()])
}
Animator.prototype.begin = function()
{
this.setCursor(0)
this.sc.width=this.sc.width
this.viewer.render(this.script[this.getCursor()])
}
Animator.prototype.init = function()
{
this.setCursor(0)
this.sc.width = this.sc.width
this.viewer.render(this.script[0])
}
init1 = function()
{
a = new Animator(new BubbleSortModel(), new BarViewer())
a.init()
}
init2 = function()
{
a = new Animator(new BubbleSortModel(), new ScatterViewer())
a.init()
}
init3 = function()
{
a = new Animator(new BubbleSortModel(), new BoxViewer())
a.init()
}
init4 = function()
{
a = new Animator(new SelectionSortModel(), new BarViewer())
a.init()
}
init5 = function()
{
a = new Animator(new SelectionSortModel(), new ScatterViewer())
a.init()
}
init6 = function()
{
a = new Animator(new SelectionSortModel(), new BoxViewer())
a.init()
}
init7 = function()
{
a = new Animator(new InsertionSortModel(), new BarViewer())
a.init()
}
init8 = function()
{
a = new Animator(new InsertionSortModel(), new ScatterViewer())
a.init()
}
init9 = function()
{
a = new Animator(new InsertionSortModel(), new BoxViewer())
a.init()
}
init10 = function()
{
a = new Animator(new ShellSortModel(), new BarViewer())
a.init()
}
init11 = function()
{
a = new Animator(new ShellSortModel(), new ScatterViewer())
a.init()
}
init12 = function()
{
a = new Animator(new ShellSortModel(), new BoxViewer())
a.init()
}
init13 = function()
{
a = new Animator(new MergeSortModel(), new BarViewer())
a.init()
}
init14 = function()
{
a = new Animator(new MergeSortModel(), new ScatterViewer())
a.init()
}
init15 = function()
{
a = new Animator(new MergeSortModel(), new BoxViewer())
a.init()
}
init16 = function()
{
a = new Animator(new QuickSortModel(), new BarViewer())
a.init()
}
init17 = function()
{
a = new Animator(new QuickSortModel(), new ScatterViewer())
a.init()
}
init18 = function()
{
a = new Animator(new QuickSortModel(), new BoxViewer())
a.init()
}

366
book/common/js/assess.js Normal file
View file

@ -0,0 +1,366 @@
var add_button = function (divid, expected, feedArray) {
var bdiv = divid + "_bt";
var element = document.createElement("input");
element.setAttribute("type", "button");
element.setAttribute("value", "Check Me!");
element.setAttribute("name", "do check");
element.onclick = function () {
checkMCMFRandom(divid, expected, feedArray);
};
$("#" + bdiv).html(element);
};
var feedbackMCMFRandom = function (divid, correct, feedbackText) {
if (correct) {
$(divid).html('Correct!! ' + feedbackText);
//$(divid).css('background-color', '#C8F4AD');
$(divid).attr('class','alert alert-success');
} else {
if (feedbackText == null) {
feedbackText = '';
}
$(divid).html("Incorrect. " + feedbackText);
//$(divid).css('background-color', '#F4F4AD');
$(divid).attr('class','alert alert-danger')
}
};
var checkFIBStorage = function (divid, blankid, expected, feedback, casi) {
var given = document.getElementById(blankid).value;
// update number of trials??
// log this to the db
modifiers = '';
if (casi) {
modifiers = 'i'
}
var patt = RegExp(expected, modifiers);
var isCorrect = patt.test(given);
if (!isCorrect) {
fbl = feedback;
for (var i = 0; i < fbl.length; i++) {
patt = RegExp(fbl[i][0]);
if (patt.test(given)) {
feedback = fbl[i][1];
break;
}
}
}
// store the answer in local storage
var storage_arr = new Array();
storage_arr.push(given);
storage_arr.push(expected);
localStorage.setItem(divid, storage_arr.join(";"));
feedBack('#' + divid + '_feedback', isCorrect, feedback);
var answerInfo = 'answer:' + given + ":" + (isCorrect ? 'correct' : 'no');
logBookEvent({'event': 'fillb', 'act': answerInfo, 'div_id': divid});
document.getElementById(divid + '_bcomp').disabled = false;
};
var feedBack = function (divid, correct, feedbackText) {
if (correct) {
$(divid).html('You are Correct!');
//$(divid).css('background-color', '#C8F4AD');
$(divid).attr('class','alert alert-success');
} else {
if (feedbackText == null) {
feedbackText = '';
}
$(divid).html("Incorrect. " + feedbackText);
//$(divid).css('background-color', '#F4F4AD');
$(divid).attr('class','alert alert-danger');
}
};
/*
Multiple Choice with Feedback for each answer
*/
var feedBackMCMF = function (divid, correct, feedbackText) {
if (correct) {
$(divid).html('Correct!! ' + feedbackText);
//$(divid).css('background-color', '#C8F4AD');
$(divid).attr('class','alert alert-success');
} else {
if (feedbackText == null) {
feedbackText = '';
}
$(divid).html("Incorrect. " + feedbackText);
//$(divid).css('background-color', '#F4F4AD');
$(divid).attr('class','alert alert-danger');
}
};
/*
Multiple Choice with Multiple Answers
*/
var feedBackMCMA = function (divid, numCorrect, numNeeded, numGiven, feedbackText) {
var answerStr = "answers";
if (numGiven == 1) answerStr = "answer";
if (numCorrect == numNeeded && numNeeded == numGiven) {
$(divid).html('Correct! <br />' + feedbackText);
//$(divid).css('background-color', '#C8F4AD');
$(divid).attr('class', 'alert alert-success');
} else {
$(divid).html("Incorrect. " + "You gave " + numGiven +
" " + answerStr + " and got " + numCorrect + " correct of " +
numNeeded + " needed.<br /> " + feedbackText);
//$(divid).css('background-color', '#F4F4AD');
$(divid).attr('class', 'alert alert-danger');
}
};
/* Randomize options */
var createHTML_MCMFRandom = function (divid, answerString, feedString, corrAnswer) {
var i, j, k, l, len;
var arr = new Array();
var fr = new Array();
var alpha = ['a', 'b', 'c', 'd', 'e'];
var ansArray = new Array();
var feedArray = new Array();
var hash = new Array();
arr = answerString.split("*separator*");
fr = feedString.split("*separator*");
for (j = 0; j < arr.length - 1; j++) {
ansArray[j] = arr[j];
hash[ansArray[j]] = fr[j];
}
i = ansArray.length;
len = i;
if (i == 0) return false;
while (--i) {
var j = Math.floor(Math.random() * ( i + 1 ));
var tempi = ansArray[i];
var tempj = ansArray[j];
ansArray[i] = tempj;
ansArray[j] = tempi;
}
for (i = 0; i < ansArray.length; i++) {
k = ansArray[i];
feedArray[i] = hash[k];
}
for (l = 0; l < len; l++) {
var rad = "<input type='radio' name='group1' value='" + l + "'/>" + "<label for= 'opt_" + l + "'>" + " " + alpha[l] + ") " + ansArray[l] + "</label><br />";
var opdiv = divid + "_op" + (l + 1);
$("#" + opdiv).html(rad);
}
var index = ansArray.indexOf(corrAnswer);
add_button(divid, index, feedArray);
return true;
};
var checkMCMFRandom = function (divid, expected, feed) {
var given;
var feedback = null;
var buttonObjs = document.forms[divid + "_form"].elements.group1;
for (var i = buttonObjs.length - 1; i >= 0; i--) {
if (buttonObjs[i].checked) {
given = buttonObjs[i].value;
feedback = feed[i];
}
}
// log the answer
var answerInfo = 'answer:' + given + ":" + (given == expected ? 'correct' : 'no');
logBookEvent({'event': 'mChoice', 'act': answerInfo, 'div_id': divid});
// give the user feedback
feedbackMCMFRandom('#' + divid + '_feedback', given == expected, feedback);
};
/* Local Storage */
var resetPage = function (divid) {
var i;
var id = new Array();
var keyArr = new Array();
id = divid.split("_");
var pageNum = id[1];
location.reload();
//erasing data from local storage
var len = localStorage.length;
if (len > 0) {
for (i = 0; i < len; i++) {
var key = localStorage.key(i);
var str = key.substring(0, 1);
if (str === pageNum) {
keyArr.push(key);
}
}
}
for (i = 0; i < keyArr.length; i++)
localStorage.removeItem(keyArr[i]);
};
var checkRadio = function (divid) {
// This function repopulates MCMF questions with a user's previous answers,
// which were previously stored into local storage
var qnum = divid;
var len = localStorage.length;
//retrieving data from local storage
if (len > 0) {
for (var i = 0; i < len; i++) {
var key = localStorage.key(i);
if (key === qnum) {
var ex = localStorage.getItem(key);
var arr = ex.split(";");
var str = key + "_opt_" + arr[0];
$("#" + str).attr("checked", "true");
document.getElementById(divid + '_bcomp').disabled = false;
}
}
}
};
var checkMultipleSelect = function (divid) {
// This function repopulates MCMA questions with a user's previous answers,
// which were stored into local storage.
var qnum = divid;
var len = localStorage.length;
if (len > 0) {
for (var i = 0; i < len; i++) {
var key = localStorage.key(i);
if (key === qnum) {
var ex = localStorage.getItem(key);
var arr = ex.split(";");
var answers = arr[0].split(",");
for (var a = 0; a < answers.length; a++) {
var str = key + "_opt_" + answers[a];
$("#" + str).attr("checked", "true");
document.getElementById(divid + '_bcomp').disabled = false;
}
}
}
}
};
var checkPreviousFIB = function (divid) {
// This function repoplulates FIB questions with a user's previous answers,
// which were stored into local storage
var qnum = divid;
var len = localStorage.length;
if (len > 0) {
for (var i = 0; i < len; i++) {
var key = localStorage.key(i);
if (key === qnum) {
var ex = localStorage.getItem(key);
var arr = ex.split(";");
var str = key + "_ans1";
$("#" + str).attr("value", arr[0]);
document.getElementById(divid + '_bcomp').disabled = false;
}
}
}
};
var checkMCMAStorage = function (divid, expected, feedbackArray) {
var given;
var feedback = "";
var correctArray = expected.split(",");
correctArray.sort();
var givenArray = [];
var correctCount = 0;
var correctIndex = 0;
var givenIndex = 0;
var givenlog = '';
var buttonObjs = document.forms[divid + "_form"].elements.group1;
// loop through the checkboxes
for (var i = 0; i < buttonObjs.length; i++) {
if (buttonObjs[i].checked) { // if checked box
given = buttonObjs[i].value; // get value of this button
givenArray.push(given) // add it to the givenArray
feedback += given + ": " + feedbackArray[i] + "<br />"; // add the feedback
givenlog += given + ",";
}
}
// sort the given array
givenArray.sort();
while (correctIndex < correctArray.length &&
givenIndex < givenArray.length) {
if (givenArray[givenIndex] < correctArray[correctIndex]) {
givenIndex++;
}
else if (givenArray[givenIndex] == correctArray[correctIndex]) {
correctCount++;
givenIndex++;
correctIndex++;
}
else {
correctIndex++;
}
} // end while
// save the data into local storage
var storage_arr = new Array();
storage_arr.push(givenArray);
storage_arr.push(expected);
localStorage.setItem(divid, storage_arr.join(";"));
// log the answer
var answerInfo = 'answer:' + givenlog.substring(0, givenlog.length - 1) + ':' +
(correctCount == correctArray.length ? 'correct' : 'no');
logBookEvent({'event': 'mChoice', 'act': answerInfo, 'div_id': divid});
// give the user feedback
feedBackMCMA('#' + divid + '_feedback', correctCount,
correctArray.length, givenArray.length, feedback);
document.getElementById(divid + '_bcomp').disabled = false;
};
var checkMCMFStorage = function (divid, expected, feedbackArray) {
var given;
var feedback = null;
var buttonObjs = document.forms[divid + "_form"].elements.group1;
for (var i = buttonObjs.length - 1; i >= 0; i--) {
if (buttonObjs[i].checked) {
given = buttonObjs[i].value;
feedback = feedbackArray[i];
}
}
//Saving data in local storage
var storage_arr = new Array();
storage_arr.push(given);
storage_arr.push(expected);
localStorage.setItem(divid, storage_arr.join(";"));
// log the answer
var answerInfo = 'answer:' + given + ":" + (given == expected ? 'correct' : 'no');
logBookEvent({'event': 'mChoice', 'act': answerInfo, 'div_id': divid});
// give the user feedback
feedBackMCMF('#' + divid + '_feedback', given == expected, feedback);
document.getElementById(divid + '_bcomp').disabled = false;
};
// for each form in the div
// get the id of the form
// call checkMe on the form... -- need metadata what kind of question what parms etc
// hidden fields for meta data??? each form defines a checkme function with no parameters
// that calls the actual function that checks the answer properly??
// summarize

950
book/common/js/bookfuncs.js Normal file
View file

@ -0,0 +1,950 @@
/**
* Created by IntelliJ IDEA.
* User: bmiller
* Date: 4/20/11
* Time: 2:01 PM
* To change this template use File | Settings | File Templates.
*/
/*
Copyright (C) 2011 Brad Miller bonelake@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function handleEdKeys(ed, e) {
if (e.keyCode === 13) {
if (e.ctrlKey) {
e.stop();
runit(ed.parentDiv);
}
else if (e.shiftKey) {
e.stop();
eval(Sk.importMainWithBody("<stdin>", false, ed.selection()));
}
} else {
if (ed.acEditEvent == false || ed.acEditEvent === undefined) {
$('#' + ed.parentDiv + ' .CodeMirror').css('border-top', '2px solid #b43232');
$('#' + ed.parentDiv + ' .CodeMirror').css('border-bottom', '2px solid #b43232');
}
ed.acEditEvent = true;
}
}
cm_editors = {};
function pyStr(x) {
if (x instanceof Array) {
return '[' + x.join(", ") + ']';
} else {
return x
}
}
function outf(text) {
var mypre = document.getElementById(Sk.pre);
// bnm python 3
x = text;
if (x.charAt(0) == '(') {
x = x.slice(1, -1);
x = '[' + x + ']';
try {
var xl = eval(x);
xl = xl.map(pyStr);
x = xl.join(' ');
} catch (err) {
}
}
text = x;
text = text.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br/>");
mypre.innerHTML = mypre.innerHTML + text;
}
function createEditors() {
var edList = new Array();
edList = document.getElementsByClassName("active_code");
for (var i = 0; i < edList.length; i++) {
newEdId = edList[i].id;
var includes = edList[i].getAttribute('prefixcode');
var lang = edList[i].getAttribute('lang');
var first_line = 1;
if (includes !== "undefined") {
includes = eval(includes)
for (var j in includes) {
var edinclude = document.getElementById(includes[j]+'_code')
first_line = first_line + edinclude.textContent.match(/\n/g).length + 1;
}
} else {
first_line = 1;
}
cm_editors[newEdId] = CodeMirror.fromTextArea(edList[i], {
mode: {name: lang,
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
firstLineNumber: first_line,
indentUnit: 4,
indentWithTabs: false,
matchBrackets: true,
extraKeys: {"Tab": "indentMore", "Shift-Tab": "indentLess"},
onKeyEvent: handleEdKeys
}
);
cm_editors[newEdId].parentDiv = edList[i].parentNode.parentNode.id;
//requestCode(edList[i].parentNode.id) // populate with user's code
}
}
function builtinRead(x) {
if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
throw "File not found: '" + x + "'";
return Sk.builtinFiles["files"][x];
}
function createActiveCode(divid,suppliedSource,sid) {
var eNode;
var acblockid;
if (sid !== undefined) {
acblockid = divid + "_" + sid;
} else {
acblockid = divid;
}
edNode = document.getElementById(acblockid);
if (edNode.children.length == 0 ) {
//edNode.style.display = 'none';
edNode.style.backgroundColor = "white";
var editor;
editor = CodeMirror(edNode, {
mode: {name: "python",
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 4,
tabMode: "indent",
matchBrackets: true,
onKeyEvent:handleEdKeys
});
var myRun = function() {
runit(acblockid);
};
var mySave = function() {
saveEditor(divid);
};
var myLoad = function() {
requestCode(divid,sid);
};
cm_editors[acblockid+"_code"] = editor;
editor.parentDiv = acblockid;
var runButton = document.createElement("button");
runButton.appendChild(document.createTextNode('Run'));
runButton.className = runButton.className + ' btn btn-success';
runButton.onclick = myRun;
edNode.appendChild(runButton);
edNode.appendChild(document.createElement('br'));
if (sid === undefined) { // We don't need load and save buttons for grading
if(isLoggedIn() == true) {
var saveButton = document.createElement("input");
saveButton.setAttribute('type','button');
saveButton.setAttribute('value','Save');
saveButton.className = saveButton.className + ' btn btn-default';
saveButton.onclick = mySave;
edNode.appendChild(saveButton);
var loadButton = document.createElement("input");
loadButton.setAttribute('type','button');
loadButton.setAttribute('value','Load');
loadButton.className = loadButton.className + ' btn btn-default';
loadButton.onclick = myLoad;
edNode.appendChild(loadButton);
} else {
var saveButton = document.createElement("input");
saveButton.setAttribute('type','button');
saveButton.setAttribute('value','Save');
saveButton.className = saveButton.className + ' btn btn-default disabled';
saveButton.setAttribute('data-toggle','tooltip');
saveButton.setAttribute('title','Register or log in to save your code');
edNode.appendChild(saveButton);
$jqTheme(saveButton).tooltip( {
'selector': '',
'placement': 'bottom'
});
var loadButton = document.createElement("input");
loadButton.setAttribute('type','button');
loadButton.setAttribute('value','Load');
loadButton.className = loadButton.className + ' btn btn-default disabled';
loadButton.setAttribute('data-toggle','tooltip');
loadButton.setAttribute('title','Register or log in to load your saved code');
edNode.appendChild(loadButton);
$jqTheme(loadButton).tooltip( {
'selector': '',
'placement': 'bottom'
});
}
}
edNode.appendChild(document.createElement('br'));
var newCanvas = edNode.appendChild(document.createElement("canvas"));
newCanvas.id = acblockid+"_canvas";
newCanvas.height = 400;
newCanvas.width = 400;
newCanvas.style.border = '2px solid black';
newCanvas.style.display = 'none';
var newPre = edNode.appendChild(document.createElement("pre"));
newPre.id = acblockid + "_pre";
newPre.className = "active_out";
myLoad();
if (! suppliedSource ) {
suppliedSource = '\n\n\n\n\n';
}
if (! editor.getValue()) {
suppliedSource = suppliedSource.replace(new RegExp('%22','g'),'"');
suppliedSource = suppliedSource.replace(new RegExp('%27','g'),"'");
editor.setValue(suppliedSource);
}
}
}
function runit(myDiv, theButton, includes, suffix) {
//var prog = document.getElementById(myDiv + "_code").value;
Sk.divid = myDiv;
$(theButton).attr('disabled', 'disabled');
Sk.isTurtleProgram = false;
if (theButton !== undefined) {
Sk.runButton = theButton;
}
$("#" + myDiv + "_errinfo").remove();
var editor = cm_editors[myDiv + "_code"];
if (editor.acEditEvent) {
logBookEvent({'event': 'activecode', 'act': 'edit', 'div_id': myDiv}); // Log the edit event
editor.acEditEvent = false;
}
var prog = "";
var text = "";
if (includes !== undefined) {
// iterate over the includes, in-order prepending to prog
for (var x in includes) {
text = cm_editors[includes[x] + "_code"].getValue();
prog = prog + text + "\n"
}
}
prog = prog + editor.getValue();
var spre = document.getElementById(myDiv + '_suffix');
var suffix = '';
if (spre) {
suffix = spre.innerText || ''; // for some reason Firefox returns undefined when no innerText
}
prog = prog + '\n' + suffix;
var mypre = document.getElementById(myDiv + "_pre");
if (mypre) mypre.innerHTML = '';
Sk.canvas = myDiv + "_canvas";
Sk.pre = myDiv + "_pre";
var can = document.getElementById(Sk.canvas);
// The following lines reset the canvas so that each time the run button
// is pressed the turtle(s) get a clean canvas.
if (can) {
can.width = can.width;
if (Sk.tg) {
Sk.tg.canvasInit = false;
Sk.tg.turtleList = [];
}
}
// set execLimit in milliseconds -- for student projects set this to
// 25 seconds -- just less than Chrome's own timer.
Sk.execLimit = 25000;
// configure Skulpt output function, and module reader
Sk.configure({output: outf,
read: builtinRead,
python3: true
});
var lang = document.getElementById(myDiv).lang;
try {
if(lang === 'python') {
Sk.importMainWithBody("<stdin>", false, prog);
} else if (lang === 'javascript') {
eval(prog);
} else {
// html
$('#'+myDiv+'_iframe').remove()
$('#'+myDiv).append('<iframe class="activehtml" id="' + myDiv + '_iframe" srcdoc="'
+ prog + '">' + '</iframe>');
}
logRunEvent({'div_id': myDiv, 'code': prog, 'errinfo': 'success'}); // Log the run event
} catch (e) {
logRunEvent({'div_id': myDiv, 'code': prog, 'errinfo': e.toString()}); // Log the run event
//alert(e);
addErrorMessage(e, myDiv)
}
if (!Sk.isTurtleProgram) {
$(theButton).removeAttr('disabled');
}
if (typeof(allVisualizers) != "undefined") {
$.each(allVisualizers, function (i, e) {
e.redrawConnectors();
});
}
}
function addErrorMessage(err, myDiv) {
var errHead = $('<h3>').html('Error')
var divEl = document.getElementById(myDiv)
var eContainer = divEl.appendChild(document.createElement('div'))
eContainer.className = 'error alert alert-danger';
eContainer.id = myDiv + '_errinfo';
eContainer.appendChild(errHead[0]);
var errText = eContainer.appendChild(document.createElement('pre'))
var errString = err.toString()
var to = errString.indexOf(":")
var errName = errString.substring(0, to);
errText.innerHTML = errString;
$(eContainer).append('<h3>Description</h3>');
var errDesc = eContainer.appendChild(document.createElement('p'));
errDesc.innerHTML = errorText[errName];
$(eContainer).append('<h3>To Fix</h3>');
var errFix = eContainer.appendChild(document.createElement('p'));
errFix.innerHTML = errorText[errName + 'Fix'];
var moreInfo = '../ErrorHelp/' + errName.toLowerCase() + '.html';
}
var errorText = {};
errorText.ParseError = "A parse error means that Python does not understand the syntax on the line the error message points out. Common examples are forgetting commas beteween arguments or forgetting a : on a for statement";
errorText.ParseErrorFix = "To fix a parse error you just need to look carefully at the line with the error and possibly the line before it. Make sure it conforms to all of Python's rules.";
errorText.TypeError = "Type errors most often occur when an expression tries to combine two objects with types that should not be combined. Like raising a string to a power";
errorText.TypeErrorFix = "To fix a type error you will most likely need to trace through your code and make sure the variables have the types you expect them to have. It may be helpful to print out each variable along the way to be sure its value is what you think it should be.";
errorText.NameError = "A name error almost always means that you have used a variable before it has a value. Often this may be a simple typo, so check the spelling carefully.";
errorText.NameErrorFix = "Check the right hand side of assignment statements and your function calls, this is the most likely place for a NameError to be found.";
errorText.ValueError = "A ValueError most often occurs when you pass a parameter to a function and the function is expecting one type and you pass another.";
errorText.ValueErrorFix = "The error message gives you a pretty good hint about the name of the function as well as the value that is incorrect. Look at the error message closely and then trace back to the variable containing the problematic value.";
errorText.AttributeError = "This error message is telling you that the object on the left hand side of the dot, does not have the attribute or method on the right hand side.";
errorText.AttributeErrorFix = "The most common variant of this message is that the object undefined does not have attribute X. This tells you that the object on the left hand side of the dot is not what you think. Trace the variable back and print it out in various places until you discover where it becomes undefined. Otherwise check the attribute on the right hand side of the dot for a typo.";
errorText.TokenError = "Most of the time this error indicates that you have forgotten a right parenthesis or have forgotten to close a pair of quotes.";
errorText.TokenErrorFix = "Check each line of your program and make sure that your parenthesis are balanced.";
errorText.TimeLimitError = "Your program is running too long. Most programs in this book should run in less than 10 seconds easily. This probably indicates your program is in an infinite loop.";
errorText.TimeLimitErrorFix = "Add some print statements to figure out if your program is in an infinte loop. If it is not you can increase the run time with sys.setExecutionLimit(msecs)";
errorText.Error = "Your program is running for too long. Most programs in this book should run in less than 30 seconds easily. This probably indicates your program is in an infinite loop.";
errorText.ErrorFix = "Add some print statements to figure out if your program is in an infinte loop. If it is not you can increase the run time with sys.setExecutionLimit(msecs)";
errorText.SyntaxError = "This message indicates that Python can't figure out the syntax of a particular statement. Some examples are assigning to a literal, or a function call";
errorText.SyntaxErrorFix = "Check your assignment statments and make sure that the left hand side of the assignment is a variable, not a literal or a function.";
errorText.IndexError = "This message means that you are trying to index past the end of a string or a list. For example if your list has 3 things in it and you try to access the item at position 3 or more.";
errorText.IndexErrorFix = "Remember that the first item in a list or string is at index position 0, quite often this message comes about because you are off by one. Remember in a list of length 3 the last legal index is 2";
errorText.URIError = "";
errorText.URIErrorFix = "";
errorText.ImportError = "This error message indicates that you are trying to import a module that does not exist";
errorText.ImportErrorFix = "One problem may simply be that you have a typo. It may also be that you are trying to import a module that exists in 'real' Python, but does not exist in this book. If this is the case, please submit a feature request to have the module added.";
errorText.ReferenceError = "This is most likely an internal error, particularly if the message references the console.";
errorText.ReferenceErrorFix = "Try refreshing the webpage, and if the error continues, submit a bug report along with your code";
errorText.ZeroDivisionError = "This tells you that you are trying to divide by 0. Typically this is because the value of the variable in the denominator of a division expression has the value 0";
errorText.ZeroDivisionErrorFix = "You may need to protect against dividing by 0 with an if statment, or you may need to rexamine your assumptions about the legal values of variables, it could be an earlier statment that is unexpectedly assigning a value of zero to the variable in question.";
errorText.RangeError = "This message almost always shows up in the form of Maximum call stack size exceeded.";
errorText.RangeErrorFix = "This always occurs when a function calls itself. Its pretty likely that you are not doing this on purpose. Except in the chapter on recursion. If you are in that chapter then its likely you haven't identified a good base case.";
errorText.InternalError = "An Internal error may mean that you've triggered a bug in our Python";
errorText.InternalErrorFix = "Report this error, along with your code as a bug.";
errorText.IndentationError = "This error occurs when you have not indented your code properly. This is most likely to happen as part of an if, for, while or def statement.";
errorText.IndentationErrorFix = "Check your if, def, for, and while statements to be sure the lines are properly indented beneath them. Another source of this error comes from copying and pasting code where you have accidentally left some bits of code lying around that don't belong there anymore.";
errorText.NotImplementedError = "This error occurs when you try to use a builtin function of Python that has not been implemented in this in-browser version of Python.";
errorText.NotImplementedErrorFix = "For now the only way to fix this is to not use the function. There may be workarounds. If you really need this builtin function then file a bug report and tell us how you are trying to use the function.";
function logBookEvent(eventInfo) {
eventInfo.course = eBookConfig.course;
if (eBookConfig.logLevel > 0) {
jQuery.get(eBookConfig.ajaxURL + 'hsblog', eventInfo); // Log the run event
}
}
function logRunEvent(eventInfo) {
eventInfo.course = eBookConfig.course;
if (eBookConfig.logLevel > 0) {
jQuery.post(eBookConfig.ajaxURL + 'runlog', eventInfo); // Log the run event
}
}
function saveSuccess(data, status, whatever) {
if (data.redirect) {
alert("Did not save! It appears you are not logged in properly")
} else if (data == "") {
alert("Error: Program not saved");
}
else {
var acid = eval(data)[0];
if (acid.indexOf("ERROR:") == 0) {
alert(acid);
} else {
// use a tooltip to provide some success feedback
var save_btn = $("#" + acid + "_saveb");
save_btn.attr('title', 'Saved your code.');
opts = {
'trigger': 'manual',
'placement': 'bottom',
'delay': { show: 100, hide: 500}
};
save_btn.tooltip(opts);
save_btn.tooltip('show');
setTimeout(function () {
save_btn.tooltip('destroy')
}, 4000);
$('#' + acid + ' .CodeMirror').css('border-top', '2px solid #aaa');
$('#' + acid + ' .CodeMirror').css('border-bottom', '2px solid #aaa');
}
}
}
function saveEditor(divName) {
// get editor from div name
var editor = cm_editors[divName + "_code"];
var data = {acid: divName, code: editor.getValue()};
$(document).ajaxError(function (e, jqhxr, settings, exception) {
alert("Request Failed for" + settings.url)
});
jQuery.post(eBookConfig.ajaxURL + 'saveprog', data, saveSuccess);
if (editor.acEditEvent) {
logBookEvent({'event': 'activecode', 'act': 'edit', 'div_id': divName}); // Log the run event
editor.acEditEvent = false;
}
logBookEvent({'event': 'activecode', 'act': 'save', 'div_id': divName}); // Log the run event
}
function requestCode(divName, sid) {
var editor = cm_editors[divName + "_code"];
var data = {acid: divName};
if (sid !== undefined) {
data['sid'] = sid;
}
logBookEvent({'event': 'activecode', 'act': 'load', 'div_id': divName}); // Log the run event
jQuery.get(eBookConfig.ajaxURL + 'getprog', data, loadEditor);
}
function loadEditor(data, status, whatever) {
// function called when contents of database are returned successfully
var res = eval(data)[0];
var editor;
if (res.sid) {
editor = cm_editors[res.acid + "_" + res.sid + "_code"];
} else {
editor = cm_editors[res.acid + "_code"];
}
var loadbtn = $("#"+res.acid+"_loadb");
if (res.source) {
editor.setValue(res.source);
loadbtn.tooltip({'placement': 'bottom',
'title': "Loaded your saved code.",
'trigger': 'manual'
});
} else {
loadbtn.tooltip({'placement': 'bottom',
'title': "No saved code.",
'trigger': 'manual'
});
}
loadbtn.tooltip('show');
setTimeout(function () {
loadbtn.tooltip('destroy')
}, 4000);
}
function disableAcOpt() {
$jqTheme('button.ac_opt').each(function (index, value) {
value.className = value.className + ' disabled';
$jqTheme(value).attr('onclick', 'return false;');
$jqTheme(value).attr('data-toggle', 'tooltip');
if ($jqTheme(value).text() == 'Save') {
$jqTheme(value).attr('title', 'Register or log in to save your code');
} else if ($jqTheme(value).text() == 'Load') {
$jqTheme(value).attr('title', 'Register or log in to load your saved code');
}
$jqTheme(value).tooltip({
'selector': '',
'delay': { show: 100, hide: 50 },
'placement': 'bottom',
'animation': true
});
});
}
function comment(blockid) {
$.modal('<iframe width="600" height="400" src="/getcomment?id=' + blockid + '" style="background-color: white">', {
//$.modal('<form><textarea name="content"></textarea><input type="submit" name="submit" > </form>', {
overlayClose: true,
closeHTML: "",
containerCss: {
width: 600,
height: 400,
backgroundColor: "#fff"
}
});
}
function sendGrade(grade, sid, acid, id) {
data = {'sid': sid, 'acid': acid, 'grade': grade, 'id': id};
jQuery.get(eBookConfig.ajaxURL + 'savegrade', data);
}
function sendComment(comment, sid, acid, id) {
data = {'sid': sid, 'acid': acid, 'comment': comment, 'id': id};
jQuery.get(eBookConfig.ajaxURL + 'savegrade', data);
}
function gotUser(data, status, whatever) {
var mess = '';
var caughtErr = false;
var d;
try {
d = eval(data)[0];
} catch (err) {
if (eBookConfig.loginRequired) {
if (confirm("Error: " + err.toString() + "Please report this error! Click OK to continue without logging in. Cancel to retry.")) {
caughtErr = true;
mess = "Not logged in";
disableAcOpt();
$('li.loginout').html('<a href="' + eBookConfig.app + '/default/user/login">Login</a>')
} else {
window.location.href = eBookConfig.app + '/default/user/login?_next=' + window.location.href
}
}
}
if (d.redirect) {
if (eBookConfig.loginRequired) {
window.location.href = eBookConfig.app + '/default/user/login?_next=' + window.location.href
} else {
mess = "Not logged in";
disableAcOpt();
$('li.loginout').html('<a href="' + eBookConfig.app + '/default/user/login">Login</a>')
}
} else {
if (!caughtErr) {
mess = d.email;
eBookConfig.isLoggedIn = true;
addNavbarLoginLink(); // will change navbar login link to say 'Log Out'
enableUserHighlights();
timedRefresh();
}
}
x = $(".loggedinuser").html();
$(".loggedinuser").html(mess);
logBookEvent({
'event': 'page',
'act': 'view',
'div_id': window.location.pathname
})
}
function timedRefresh() {
timeoutPeriod = 4500000; // 75 minutes
$(document).bind("idle.idleTimer", function () {
// After timeout period send the user back to the index. This will force a login
// if needed when they want to go to a particular page. This may not be perfect
// but its an easy way to make sure laptop users are properly logged in when they
// take quizzes and save stuff.
if (location.href.indexOf('index.html') < 0)
location.href = eBookConfig.app + '/static/' + eBookConfig.course + '/index.html'
});
$.idleTimer(timeoutPeriod);
}
function shouldLogin() {
var sli = true;
if (window.location.href.indexOf('file://') > -1)
sli = false;
return sli;
}
function isLoggedIn() {
if (typeof eBookConfig.isLoggedIn !== undefined) {
return eBookConfig.isLoggedIn;
}
return false;
}
function addUserToFooter() {
// test to see if online before doing this.
if (shouldLogin()) {
jQuery.get(eBookConfig.ajaxURL + 'getuser', null, gotUser)
} else {
x = $(".footer").html();
$(".footer").html(x + 'not logged in');
disableAcOpt();
logBookEvent({'event': 'page', 'act': 'view', 'div_id': window.location.pathname})
}
}
function addNavbarLoginLink() {
if (isLoggedIn()) {
$('#profilelink').show();
$('#passwordlink').show();
$('#registerlink').hide();
$('li.loginout').html('<a href="' + eBookConfig.app + '/default/user/logout">Log Out</a>')
} else {
$('#registerlink').show();
$('#profilelink').hide();
$('#passwordlink').hide();
$('li.loginout').html('<a href="' + eBookConfig.app + '/default/user/login">Login</a>')
}
}
/*
Since I don't want to modify the codelens code I'll attach the logging functionality this way.
This actually seems like a better way to do it maybe across the board to separate logging
from the real funcionality. It would also allow a better way of turning off/on logging..
As long as Philip doesn't go and change the id values for the buttons and slider this will
continue to work.... In the best of all worlds we might add a function to the visualizer to
return the buttons, but I'm having a hard time thinking of any other use for that besides mine.
*/
function attachLoggers(codelens, divid) {
codelens.domRoot.find("#jmpFirstInstr").click(function () {
logBookEvent({'event': 'codelens', 'act': 'first', 'div_id': divid});
});
codelens.domRoot.find("#jmpLastInstr").click(function () {
logBookEvent({'event': 'codelens', 'act': 'last', 'div_id': divid});
});
codelens.domRoot.find("#jmpStepBack").click(function () {
logBookEvent({'event': 'codelens', 'act': 'back', 'div_id': divid});
});
codelens.domRoot.find("#jmpStepFwd").click(function () {
logBookEvent({'event': 'codelens', 'act': 'fwd', 'div_id': divid});
});
codelens.domRoot.find("#executionSlider").bind('slide', function (evt, ui) {
logBookEvent({'event': 'codelens', 'act': 'slide', 'div_id': divid});
});
}
function redrawAllVisualizerArrows() {
if (allVisualizers !== undefined) {
for (var v in allVisualizers)
allVisualizers[v].redrawConnectors();
}
}
function getNumUsers() {
$.getJSON(eBookConfig.ajaxURL + 'getnumusers', setNumUsers)
}
function getOnlineUsers() {
$.getJSON(eBookConfig.ajaxURL + 'getnumonline', setOnlineUsers)
}
function setOnlineUsers(data) {
var d = data[0];
$("#numuserspan").text(d.online);
}
function setNumUsers(data) {
var d = data[0];
$("#totalusers").html(d.numusers);
}
function instructorMchoiceModal(data) {
// data.reslist -- student and their answers
// data.answerDict -- answers and count
// data.correct - correct answer
var res = '<table><tr><th>Student</th><th>Answer(s)</th></tr>';
for (var i in data) {
res += '<tr><td>' + data[i][0] + '</td><td>' + data[i][1] + '</td></tr>';
}
res += '</table>';
return res;
}
function compareModal(data, status, whatever) {
var datadict = eval(data)[0];
var answers = datadict.answerDict;
var misc = datadict.misc;
var kl = Object.keys(answers).sort();
var body = '<table>';
body += '<tr><th>Answer</th><th>Percent</th></tr>';
var theClass= '';
for (var k in kl) {
if (kl[k] == misc.correct) {
theClass = 'success';
} else {
theClass = 'info';
}
body += '<tr><td>' + kl[k] + '</td><td class="compare-me-progress">';
pct = answers[kl[k]] + '%';
body += '<div class="progress">';
body += ' <div class="progress-bar progress-bar-' + theClass + '" style="width:'+pct+';">' + pct;
body += ' </div>';
body += '</div></td></tr>';
}
body += '</table>';
if (misc['yourpct'] !== 'unavailable') {
body += '<br /><p>You have ' + misc['yourpct'] + '% correct for all questions</p>';
}
if (datadict.reslist !== undefined) {
body += instructorMchoiceModal(datadict.reslist);
}
var html = '<div class="modal fade">' +
' <div class="modal-dialog compare-modal">' +
' <div class="modal-content">' +
' <div class="modal-header">' +
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
' <h4 class="modal-title">Distribution of Answers</h4>' +
' </div>' +
' <div class="modal-body">' +
body +
' </div>' +
' </div>' +
' </div>' +
'</div>';
el = $(html);
el.modal();
}
function compareAnswers(div_id) {
data = {};
data.div_id = div_id;
data.course = eBookConfig.course;
jQuery.get(eBookConfig.ajaxURL + 'getaggregateresults', data, compareModal);
}
function compareFITB(data, status, whatever) {
var answers = eval(data)[0];
var misc = eval(data)[1];
var body = '<table>';
body += '<tr><th>Answer</th><th>Count</th></tr>';
for (var row in answers) {
body += '<tr><td>' + answers[row].answer + '</td><td>' + answers[row].count + ' times</td></tr>';
}
body += '</table>';
if (misc['yourpct'] !== 'unavailable') {
body += '<br /><p>You have ' + misc['yourpct'] + '% correct for all questions</p>';
}
var html = '<div class="modal fade">' +
' <div class="modal-dialog compare-modal">' +
' <div class="modal-content">' +
' <div class="modal-header">' +
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
' <h4 class="modal-title">Top Answers</h4>' +
' </div>' +
' <div class="modal-body">' +
body +
' </div>' +
' </div>' +
' </div>' +
'</div>';
el = $(html);
el.modal();
}
function compareFITBAnswers(div_id) {
data = {};
data.div_id = div_id;
data.course = eBookConfig.course;
jQuery.get(eBookConfig.ajaxURL + 'gettop10Answers', data, compareFITB);
}
/* Listen for changes to/addition of a div containing unittest results
(which are generated by Skulpt) and add some nice styles to it*/
function styleUnittestResults() {
$(document).on("DOMNodeInserted", '.unittest-results', function (ev) {
// select the target node
var unittest_results_target = ev.target;
// create an observer instance
var observer = new MutationObserver(function(mutations) {
$(mutations).each(function() {
if (this.type == "attributes") {
var target = $(this.target);
// apply the .alert classes
if(target.text().indexOf("Fail") === -1) {
target.removeClass('alert-danger');
target.addClass('alert alert-success');
} else if (target.text().indexOf('Fail') >= 0) {
target.removeClass('alert-success');
target.addClass('alert alert-danger');
}
// add the progress bar indicating the percent of tests passed
var paragraph = target.find('p');
var result_text = paragraph.text().split(" ");
var pct = '';
$(result_text).each(function() {
if (this.indexOf("%") !== -1) {
pct = this;
var html = 'You passed:' +
'<div class="progress unittest-results-progress">';
if (pct == '100.0%') {
html += ' <div class="progress-bar progress-bar-success" style="width:'+pct+';">';
} else {
html += ' <div class="progress-bar progress-bar-warning" style="width:'+pct+';">';
}
html += pct +
' </div>' +
'</div>';
paragraph.html(html);
}
});
}
});
});
// configuration of the observer:
var config = { attributes: true,
attributeFilter: ['style'],
childList: true,
characterData: true,
subtree: false };
// pass in the target node, as well as the observer options
observer.observe($(unittest_results_target).get(0), config);
});
}
function createScratchActivecode() {
/* set up the scratch Activecode editor in the search menu */
// use the URL to assign a divid - each page should have a unique Activecode block id.
// Remove everything from the URL but the course and page name
var divid = document.URL.split('#')[0];
if (divid.indexOf('static') > 0 ) {
divid = divid.split('static')[1];
} else {
// divid = divid.split('//')[1];
divid = divid.split('?')[0]; // remove any query string (e.g ?lastPosition)
}
divid = divid.replaceAll(':','')
divid = divid.replaceAll('/', '').replace('.html', '');
divid = divid.replaceAll('.','')
// generate the HTML
var html = '<div id="ac_modal_' + divid + '" class="modal fade">' +
' <div class="modal-dialog scratch-ac-modal">' +
' <div class="modal-content">' +
' <div class="modal-header">' +
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
' <h4 class="modal-title">Scratch ActiveCode</h4>' +
' </div> ' +
' <div class="modal-body">' +
' <div id="' + divid + '">' +
' <div id="' + divid + '_code_div" style="display: block">' +
' <textarea cols="50" rows="12" id="' + divid + '_code" class="active_code">\n\n\n\n\n</textarea>' +
' </div>' +
' <p class="ac_caption"><span class="ac_caption_text">Scratch Editor</span> </p>' +
' <button class="btn btn-success" id="' + divid + '_runb" onclick="runit(\'' + divid + '\',this, undefined);">Run</button>' +
' <div id="cont"></div>' +
' <button class="ac_opt btn btn-default" style="display: inline-block" id="' + divid + '_saveb" onclick="saveEditor(\'' + divid + '\');">Save</button>' +
' <button class="ac_opt btn btn-default" style="display: inline-block" id="' + divid + '_loadb" onclick="requestCode(\'' + divid + '\');">Load</button>' +
' <div style="text-align: center">' +
' <canvas id="' + divid + '_canvas" class="ac-canvas" height="400" width="400" style="border-style: solid; display: none; text-align: center"></canvas>' +
' </div>' +
' <pre id="' + divid + '_suffix" style="display:none">' +
' </pre>' +
' <pre id="' + divid + '_pre" class="active_out">' +
' </pre>' +
' </div>' +
' </div>' +
' </div>' +
' </div>' +
'</div>';
el = $(html);
$('body').append(el);
el.on('shown.bs.modal show.bs.modal', function () {
el.find('.CodeMirror').each(function (i, e) {
e.CodeMirror.refresh();
e.CodeMirror.focus();
});
});
$(document).bind('keypress', '\\', function(evt) {
toggleScratchActivecode();
return false;
});
}
function toggleScratchActivecode() {
var bforeanchor = document.URL.split('#')[0]
var suffix = 'index'
if (bforeanchor.indexOf('static') > 0) {
suffix = bforeanchor.split('static')[1].split('?')[0].replaceAll('/', '').replace('.html', '');
} else {
suffix = bforeanchor.split('?')[0].replaceAll('/', '').replace('.html', '');
suffix = suffix.replaceAll(':','')
suffix = suffix.replaceAll('.','')
}
var divid = "ac_modal_" + suffix;
var div = $("#" + divid);
div.modal('toggle');
}
function showGradeSummary(data, status, whatever) {
var report = eval(data)[0];
// check for report['message']
if (report['grade']) {
body = "<h4>Grade Report</h4>" +
"<p>This assignment: " + report['grade'] + "</p>" +
"<p>" + report['comment'] + "</p>" +
"<p>Number of graded assignments: " + report['count'] + "</p>" +
"<p>Average score: " + report['avg'] + "</p>"
} else {
body = "<h4>You must be Logged in to see your grade</h4>";
}
var html = '<div class="modal fade">' +
' <div class="modal-dialog compare-modal">' +
' <div class="modal-content">' +
' <div class="modal-header">' +
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
' <h4 class="modal-title">Assignment Feedback</h4>' +
' </div>' +
' <div class="modal-body">' +
body +
' </div>' +
' </div>' +
' </div>' +
'</div>';
el = $(html);
el.modal();
}
function createGradeSummary(div_id) {
// get grade and comments for this assignment
// get summary of all grades for this student
// display grades in modal window
var data = {'div_id':div_id}
jQuery.get(eBookConfig.ajaxURL + 'getassignmentgrade', data, showGradeSummary);
}

3192
book/common/js/codemirror.js Normal file

File diff suppressed because it is too large Load diff

237
book/common/js/doctools.js Normal file
View file

@ -0,0 +1,237 @@
/*
* doctools.js
* ~~~~~~~~~~~
*
* Sphinx JavaScript utilities for all documentation.
*
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
/**
* select a different prefix for underscore
*/
$u = _.noConflict();
/**
* make the code below compatible with browsers without
* an installed firebug like debugger
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
"dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
"profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {};
}
*/
/**
* small helper function to urldecode strings
*/
jQuery.urldecode = function(x) {
return decodeURIComponent(x).replace(/\+/g, ' ');
}
/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;
/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s == 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};
/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node) {
if (node.nodeType == 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
var span = document.createElement("span");
span.className = className;
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this);
});
}
}
return this.each(function() {
highlight(this);
});
};
/**
* Small JavaScript module for the documentation.
*/
var Documentation = {
init : function() {
this.fixFirefoxAnchorBug();
this.highlightSearchWords();
this.initIndexTable();
},
/**
* i18n support
*/
TRANSLATIONS : {},
PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
LOCALE : 'unknown',
// gettext and ngettext don't access this so that the functions
// can safely bound to a different name (_ = Documentation.gettext)
gettext : function(string) {
var translated = Documentation.TRANSLATIONS[string];
if (typeof translated == 'undefined')
return string;
return (typeof translated == 'string') ? translated : translated[0];
},
ngettext : function(singular, plural, n) {
var translated = Documentation.TRANSLATIONS[singular];
if (typeof translated == 'undefined')
return (n == 1) ? singular : plural;
return translated[Documentation.PLURALEXPR(n)];
},
addTranslations : function(catalog) {
for (var key in catalog.messages)
this.TRANSLATIONS[key] = catalog.messages[key];
this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
this.LOCALE = catalog.locale;
},
/**
* add context elements like header anchor links
*/
addContextElements : function() {
$('div[id] > :header:first').each(function() {
$('<a class="headerlink">\u00B6</a>').
attr('href', '#' + this.id).
attr('title', _('Permalink to this headline')).
appendTo(this);
});
$('dt[id]').each(function() {
$('<a class="headerlink">\u00B6</a>').
attr('href', '#' + this.id).
attr('title', _('Permalink to this definition')).
appendTo(this);
});
},
/**
* workaround a firefox stupidity
*/
fixFirefoxAnchorBug : function() {
if (document.location.hash && $.browser.mozilla)
window.setTimeout(function() {
document.location.href += '';
}, 10);
},
/**
* highlight the search words provided in the url in the text
*/
highlightSearchWords : function() {
var params = $.getQueryParameters();
var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
if (terms.length) {
var body = $('div.body');
window.setTimeout(function() {
$.each(terms, function() {
body.highlightText(this.toLowerCase(), 'highlighted');
});
}, 10);
$('<p class="highlight-link"><a href="javascript:Documentation.' +
'hideSearchWords()">' + _('Hide Search Matches') + '</a></p>')
.appendTo($('#searchbox'));
}
},
/**
* init the domain index toggle buttons
*/
initIndexTable : function() {
var togglers = $('img.toggler').click(function() {
var src = $(this).attr('src');
var idnum = $(this).attr('id').substr(7);
$('tr.cg-' + idnum).toggle();
if (src.substr(-9) == 'minus.png')
$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
else
$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
}).css('display', '');
if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
togglers.click();
}
},
/**
* helper function to hide the search marks again
*/
hideSearchWords : function() {
$('#searchbox .highlight-link').fadeOut(300);
$('span.highlighted').removeClass('highlighted');
},
/**
* make the url absolute
*/
makeURL : function(relativeURL) {
return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
},
/**
* get the current relative url
*/
getCurrentURL : function() {
var path = document.location.pathname;
var parts = path.split(/\//);
$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
if (this == '..')
parts.pop();
});
var url = parts.join('/');
return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
}
};
// quick alias for translations
_ = Documentation.gettext;
$(document).ready(function() {
Documentation.init();
});

Some files were not shown because too many files have changed in this diff Show more